GraphQL API

Auto-generated from your TOML config. Every table gets a query endpoint.

Endpoints

Enable the API with [api] port in TOML or --api-port on the CLI.

PathDescription
/GraphiQL IDE
/graphqlGraphQL endpoint
/healthLiveness probe
/readyReadiness (503 during backfill)
/metricsPrometheus metrics

Filter operators

Every column on every table supports these operators in the where clause:

SuffixMeaning
_eqEqual (default when no suffix)
_neNot equal
_gtGreater than
_gteGreater than or equal
_ltLess than
_lteLess than or equal
_inIn array
_not_inNot in array
_containsString contains
_starts_withString starts with

Filter composition

Combine filters with AND and OR for complex queries.

graphql
{
  usdc_transfers(
    where: {
      OR: [
        { from_address: "0xAbc..." }
        { to_address: "0xAbc..." }
      ]
      value_gte: "1000000000"
    }
    orderBy: block_number
    orderDirection: desc
    first: 50
  ) {
    block_number
    tx_hash
    from_address
    to_address
    value
    block_timestamp
  }
}

Filters at the same level in where are combined with AND by default.

Pagination

Two pagination modes:

Cursor-based

graphql
{
  usdc_transfers(first: 100, after: "eyJpZCI6MTAwfQ==") {
    block_number
    tx_hash
  }
}

Use first and after with the cursor returned from the previous page. Best for large datasets and infinite scroll.

Offset-based

graphql
{
  usdc_transfers(first: 50, skip: 100) {
    block_number
    tx_hash
  }
}

Use first and skip for simple page-based navigation.

Sorting

graphql
{
  usdc_transfers(
    orderBy: block_number
    orderDirection: desc
    first: 10
  ) {
    block_number
    value
  }
}

orderBy accepts any column name. orderDirection is asc or desc.