Links
Comment on page

Async HTTP API

Query web3 data with SQL via the async HTTP API
Blockchain and contract data may be queried by posting SQL to the /v1/sql API. See Tables for a list of tables to query or browse the example queries listed in the menu.
By posting a JSON payload specifying list of query completion notifications results can be fetched asynchronously once the query has completed.
Webhooks are currently the only supported type of query completion notification. Get in touch on Discord to suggest other types of notification methods.
Results will only be available for fetching for 20 mins after the query was made.

Sample request payload

{
"sql": "SELECT number, \"timestamp\", hash, transaction_count, gas_used FROM eth.recent_blocks LIMIT 10",
"notifications": [
{
"name": "test notification",
"type": "webhook",
"uri": "https://webhook.site/b6f7a959-973e-4bc3-9901-67b397aa55e4"
}
]
}

Requirements and limitations

  • An API key is required for all SQL queries.
  • Results are limited to 500 rows. Use offset and limit to page through results.
  • Requests are limited to 90 seconds.
post
https://data.spiceai.io
/v1/sql
Perform an async SQL query
get
https://data.spiceai.io
/v1/sql/{query_id}
Fetch SQL query results
Last modified 1mo ago