HTTP API

Query web3 data with SQL via the HTTP API

Blockchain and contract data may be queried by posting SQL to the /v1/sql API and /v1/firesql API for Firecached data. For documentation on the Spice Firecache see .

See Tables for a list of tables to query or browse the example queries listed in the menu.

Requirements and limitations

  • An API key is required for all SQL queries.

  • Results are limited to 500 rows. Use the Apache Arrow Flight API to fetch up to 1M rows in a single query or the Async HTTP API to fetch results with paging.

  • Requests are limited to 90 seconds.

Perform a SQL query

POST https://data.spiceai.io/v1/sql

The SQL query should be sent in the body of the request as plain text

Query Parameters

Name
Type
Description

api_key

String

The API Key for your Spice app

Headers

Name
Type
Description

Content-Type*

String

text/plain

X-API-KEY

String

The API Key for your Spice app

{
    // Example response from: `select count(number) from eth.recent_blocks`
    {
    "rowCount": 1,
    "schema": [
        {
            "name": "EXPR$0",
            "type": {
                "name": "BIGINT"
            }
        }
    ],
    "rows": [
        {
            "EXPR$0": 149
        }
    ]
}
}

Perform a Firecache SQL Query

POST https://data.spiceai.io/v1/firesql

The SQL query should be sent in the body of the request as plain text

Query Parameters

Name
Type
Description

api_key

String

The API Key for your Spice app

Headers

Name
Type
Description

Content-Type*

String

text/plain

X-API-KEY

String

The API Key for your Spice app

curl --request POST \
  --url https://data.spiceai.io/v1/sql \
  --header 'Content-Type: text/plain' \
  --header 'X-API-Key: [api-key]' \
  --data 'select count(number) from eth.recent_blocks'

Last updated