Onchain

Blockchain Structured Query

Send a JSON object describing the query. Example: {"source":"agent.ethereum_dex_trades","fields":["block_time"],"filters":[{"field":"block_date","op":"gte","value":"2025-03-01"}],"limit":1}.

Use this endpoint when you want structured filtering without writing raw SQL. Discover tables and columns first with GET /v1/onchain/schema.

Key rules:

  • Source format: agent.<table_name>
  • Max 10,000 rows (default 20), 30s timeout
  • Always filter on block_date for large tables
  • Never filter by symbol — it is unindexed (full scan). To resolve a ticker to a contract address, use GET /v1/search/token?q={symbol}&chain={chain} and filter by contract_address instead
  • For transfer tables, amount is decimal-adjusted display units; amount_raw is the original base-unit value

Data refresh: ~24 hours.

Example

{
  "source": "agent.ethereum_dex_trades",
  "fields": ["block_time", "project", "token_pair", "amount_usd", "taker"],
  "filters": [
    {"field": "block_date", "op": "gte", "value": "2025-03-01"},
    {"field": "project", "op": "eq", "value": "uniswap"},
    {"field": "amount_usd", "op": "gte", "value": 100000}
  ],
  "sort": [{"field": "amount_usd", "order": "desc"}],
  "limit": 20
}
post/gateway/v1/onchain/query

Request body

$schemastring uri

A URL to the JSON Schema for this object.

fieldsstring[] nullable

Columns to return. Omit to return all columns.

limitinteger

Max rows to return. Default 20, max 10000

offsetinteger

Rows to skip for pagination. Default 0

sourcestring required

Fully-qualified table name like agent.ethereum_yields_daily. Use GET /v1/onchain/schema for available tables.

Example request

{
  "$schema": "https://example.com/schemas/StructuredQuery.json",
  "fields": [
    "project",
    "symbol",
    "apy",
    "tvl_usd"
  ],
  "filters": [
    {
      "field": "block_number",
      "op": "eq"
    }
  ],
  "limit": 20,
  "sort": [
    {
      "field": "gas",
      "order": "desc"
    }
  ],
  "source": "agent.ethereum_yields_daily"
}

Response

OK

$schemastring uri

A URL to the JSON Schema for this object.

dataobject[] nullable required

Example response

{
  "$schema": "https://example.com/schemas/DataResponseOnchainRow.json"
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.