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
Requirements and limitations
An API key is required for all SQL queries.
Results are limited to 500 rows. Use
offset
andlimit
to page through results.Requests are limited to 90 seconds.
Perform an async SQL query
POST
https://data.spiceai.io/v1/sql
The SQL query should be sent in the JSON payload along with the list of notification configs.
Query Parameters
Name | Type | Description |
---|---|---|
api_key | String | The API Key for your Spice app |
Headers
Name | Type | Description |
---|---|---|
Content-Type* | String | application/json |
X-API-KEY | String | The API Key for your Spice app |
Request Body
Name | Type | Description |
---|---|---|
sql* | String | The SQL query |
notifications* | Array | Array of notification objects. |
Fetch SQL query results
GET
https://data.spiceai.io/v1/sql/{query_id}
Use the queryId returned from the query request or from the body of the webhook notification to fetch the results.
Path Parameters
Name | Type | Description |
---|---|---|
query_id* | String | The ID of the SQL query |
Query Parameters
Name | Type | Description |
---|---|---|
offset | Number | The row offset to fetch results from. Use this to page through results. |
limit | Number | The limit of rows to return in each response. Max limit per request is 500. |
Last updated