.md

Subgraphs API

Read your subgraph's tables, describe them, and deploy and operate them. Reading is under /v1/subgraphs; deploying and operating is the write plane under /api/subgraphs on a self-hosted instance. Envelope and filters are in REST conventions.

List a table's rows

GET/v1/subgraphs/{name}/{table}
Open .md

Rows from one subgraph table, keyset-paginated. By default pages walk _id; _sort walks one column instead, with _id as the tiebreaker. next_cursor is set on every page that returned rows and is null only on an empty page: pass it back as cursor to continue, or tail new rows with cursor = next_cursor ?? cursor. _offset is refused (400): deep OFFSET scans hurt on big tables. _limit defaults to 50.

Path parameters

namestringrequired#

Subgraph name, as deployed (the name in its definition).

tablestringrequired#

Table name, one of the keys of the definition's schema. GET /v1/subgraphs/{name} lists them.

Filters

filtersobject#

Column filters, one query param each, ANDed. Any table column or system column (_id, _block_height, _tx_id, _created_at) works. col=value is equality; col.op=value applies an operator, one of gte, lte, gt, lt, neq, like, in, notIn. like is a case-insensitive contains match. in and notIn take a comma-separated list. An unknown column is 400 INVALID_COLUMN; an unknown operator, or the misplaced form col=op.value, is 400 VALIDATION_ERROR. Bare limit, offset, sort, order, fields and search are 400: control params take a leading underscore.

Range and paging

_limitinteger · 1 to 1000#

Page size, 1 to 1000. A non-integer, 0, a negative, or anything over 1000 is 400, not clamped.

cursorstring#

The previous page's next_cursor, verbatim. Opaque: its shape depends on _sort, so never build one. A cursor issued under one _sort/_order is 400 under another.

_sortstring#

One column to sort by. A comma list and jsonb columns are 400. Omit to page by _id.

_orderenum#

Direction of the _sort column, or of _id without _sort. Anything but asc or desc is 400.

2 possible values
ascdesc
_fieldsstring#

Comma-separated columns to return. An unknown name is 400 INVALID_COLUMN. The cursor still works: _id and the _sort column are read for it and dropped from rows you did not ask them for.

Returns

The Subgraph rows page object.

  • 200One page of rows
  • 400A parameter, filter, cursor or body field was refused; code says which
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No readable subgraph by that name (SUBGRAPH_NOT_FOUND), or it has no such table (TABLE_NOT_FOUND)
  • 429Hosted only: rate limited; retry after Retry-After seconds. Self-hosted reads are not rate limited

Count a table's rows

GET/v1/subgraphs/{name}/{table}/count
Open .md

How many rows match the filters. Takes the same column filters and _search as the row list.

Path parameters

namestringrequired#

Subgraph name, as deployed (the name in its definition).

tablestringrequired#

Table name, one of the keys of the definition's schema. GET /v1/subgraphs/{name} lists them.

Query parameters

_countenum#

exact runs COUNT(*). estimate reads the planner's row estimate instead, with no table scan, but only when there are no filters and no _search; otherwise it counts exactly. The estimate can be -1 before the table's first ANALYZE.

2 possible values
exactestimate
filtersobject#

Column filters, one query param each, ANDed. Any table column or system column (_id, _block_height, _tx_id, _created_at) works. col=value is equality; col.op=value applies an operator, one of gte, lte, gt, lt, neq, like, in, notIn. like is a case-insensitive contains match. in and notIn take a comma-separated list. An unknown column is 400 INVALID_COLUMN; an unknown operator, or the misplaced form col=op.value, is 400 VALIDATION_ERROR. Bare limit, offset, sort, order, fields and search are 400: control params take a leading underscore.

Returns

The Subgraph row count object.

  • 200The count
  • 400A parameter, filter, cursor or body field was refused; code says which
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No readable subgraph by that name (SUBGRAPH_NOT_FOUND), or it has no such table (TABLE_NOT_FOUND)
  • 429Hosted only: rate limited; retry after Retry-After seconds. Self-hosted reads are not rate limited

Aggregate a table's rows

GET/v1/subgraphs/{name}/{table}/aggregate
Open .md

Scalar aggregates over the rows that match the filters: count, distinct counts, and sum, min and max of numeric columns. With no aggregate param it returns { "count": n }. Up to 32 aggregate columns per request. Takes the same column filters and _search as the row list.

Path parameters

namestringrequired#

Subgraph name, as deployed (the name in its definition).

tablestringrequired#

Table name, one of the keys of the definition's schema. GET /v1/subgraphs/{name} lists them.

Query parameters

_countstring#

Include count. Any value but false turns it on. count is also returned when no other aggregate is asked for.

_countDistinctstring#

Comma-separated columns to count distinct values of. Any column.

_sumstring#

Comma-separated columns to sum. Numeric only: uint or int columns, or _block_height; others are 400 NON_NUMERIC_COLUMN.

_minstring#

Comma-separated numeric columns to take the minimum of.

_maxstring#

Comma-separated numeric columns to take the maximum of.

filtersobject#

Column filters, one query param each, ANDed. Any table column or system column (_id, _block_height, _tx_id, _created_at) works. col=value is equality; col.op=value applies an operator, one of gte, lte, gt, lt, neq, like, in, notIn. like is a case-insensitive contains match. in and notIn take a comma-separated list. An unknown column is 400 INVALID_COLUMN; an unknown operator, or the misplaced form col=op.value, is 400 VALIDATION_ERROR. Bare limit, offset, sort, order, fields and search are 400: control params take a leading underscore.

Returns

The Subgraph aggregates object.

  • 200The aggregates
  • 400A column or filter was refused: INVALID_COLUMN, NON_NUMERIC_COLUMN, TOO_MANY_AGGREGATES, or VALIDATION_ERROR
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No readable subgraph by that name (SUBGRAPH_NOT_FOUND), or it has no such table (TABLE_NOT_FOUND)
  • 429Hosted only: rate limited; retry after Retry-After seconds. Self-hosted reads are not rate limited

Stream a table's new rows over SSE

GET/v1/subgraphs/{name}/{table}/stream
Open .md

Server-Sent Events of rows as they are indexed. Starts at the table's newest row and sends only rows after it; since replays from a block height first, then keeps tailing. The server polls every 1.5 seconds, sends each matching row in _id order, and sends a ping event after 20 idle seconds. Column filters and _search apply; _limit, _sort, _order and _fields are checked but have no effect, and rows always come back whole. Nothing is stored between connections, and Last-Event-ID is not read: to resume, reconnect with since.

Path parameters

namestringrequired#

Subgraph name, as deployed (the name in its definition).

tablestringrequired#

Table name, one of the keys of the definition's schema. GET /v1/subgraphs/{name} lists them.

Query parameters

sinceinteger#

Block height to replay from: rows with _block_height at or above it, then the live tail. A value that is not a number is ignored. With nothing at or above it yet, the stream tails live.

filtersobject#

Column filters, one query param each, ANDed. Any table column or system column (_id, _block_height, _tx_id, _created_at) works. col=value is equality; col.op=value applies an operator, one of gte, lte, gt, lt, neq, like, in, notIn. like is a case-insensitive contains match. in and notIn take a comma-separated list. An unknown column is 400 INVALID_COLUMN; an unknown operator, or the misplaced form col=op.value, is 400 VALIDATION_ERROR. Bare limit, offset, sort, order, fields and search are 400: control params take a leading underscore.

Returns

text/event-stream

  • 200An open event stream. Each row arrives as one message: id is the row's _id, data is the row as JSON, in the same shape as the row list. Idle keepalives are event: ping with empty data.
  • 400A parameter, filter, cursor or body field was refused; code says which
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No readable subgraph by that name (SUBGRAPH_NOT_FOUND), or it has no such table (TABLE_NOT_FOUND)
  • 429Hosted only: rate limited; retry after Retry-After seconds. Self-hosted reads are not rate limited

Get one row by id

GET/v1/subgraphs/{name}/{table}/{id}
Open .md

One row by its _id, wrapped as { data }. An id that isn't an integer, or no row with it, is a 404.

Path parameters

namestringrequired#

Subgraph name, as deployed (the name in its definition).

tablestringrequired#

Table name, one of the keys of the definition's schema. GET /v1/subgraphs/{name} lists them.

idstringrequired#

The row's _id.

Returns

  • 200The row.
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph, table, or row with that name or id (SUBGRAPH_NOT_FOUND, TABLE_NOT_FOUND, ROW_NOT_FOUND)
  • 429Hosted only: rate limited; retry after Retry-After seconds. Self-hosted reads are not rate limited
Open .md

Every subgraph deployed on this instance, with its tables, sync position, and approximate row count. Hosted: your account's subgraphs, then every public one. The anonymous list is cached for 30 seconds and carries an ETag; send If-None-Match for a 304.

Returns

The Subgraph directory object.

  • 200The subgraph directory
  • 304Anonymous request whose If-None-Match matches the current ETag; no body
  • 401This bind requires the instance token, and it was missing or wrong
  • 429Hosted only: rate limited; retry after Retry-After seconds. Self-hosted reads are not rate limited
Open .md

Metadata for one subgraph: each table's read endpoint and declared columns, how far indexing has reached, and links to its generated docs. columns lists only the definition's columns; the system columns _id, _block_height, _tx_id and _created_at exist on every table too.

Path parameters

namestringrequired#

Subgraph name, as deployed (the name in its definition).

Returns

The Subgraph object.

  • 200Subgraph metadata
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No readable subgraph by that name (SUBGRAPH_NOT_FOUND). Hosted: another account's private subgraph reads as missing
  • 429Hosted only: rate limited; retry after Retry-After seconds. Self-hosted reads are not rate limited

Get a subgraph's OpenAPI document

GET/v1/subgraphs/{name}/openapi.json
Open .md

An OpenAPI 3.1 document generated from the subgraph's definition: one list path and one count path per table, a row schema per table, and the column filters each table accepts. Feed it to a client generator.

Path parameters

namestringrequired#

Subgraph name, as deployed (the name in its definition).

Query parameters

serverstring#

Base URL written into the document's endpoints and examples. Defaults to this request's origin, honoring X-Forwarded-Proto.

Returns

The Subgraph OpenAPI document object.

  • 200The generated OpenAPI document
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No readable subgraph by that name (SUBGRAPH_NOT_FOUND). Hosted: another account's private subgraph reads as missing
  • 429Hosted only: rate limited; retry after Retry-After seconds. Self-hosted reads are not rate limited

Get a subgraph's agent schema

GET/v1/subgraphs/{name}/schema.json
Open .md

A compact JSON description of the subgraph for agents and tools: per table, its endpoints, exact row count, columns, the query params and filters it accepts, and example requests.

Path parameters

namestringrequired#

Subgraph name, as deployed (the name in its definition).

Query parameters

serverstring#

Base URL written into the document's endpoints and examples. Defaults to this request's origin, honoring X-Forwarded-Proto.

Returns

The Subgraph agent schema object.

  • 200The generated agent schema
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No readable subgraph by that name (SUBGRAPH_NOT_FOUND). Hosted: another account's private subgraph reads as missing
  • 429Hosted only: rate limited; retry after Retry-After seconds. Self-hosted reads are not rate limited

Get a subgraph's markdown docs

GET/v1/subgraphs/{name}/docs.md
Open .md

The agent schema rendered as markdown: a section per table with its endpoints, row count, column table, query params, filters, and a curl example. Served as text/markdown.

Path parameters

namestringrequired#

Subgraph name, as deployed (the name in its definition).

Query parameters

serverstring#

Base URL written into the document's endpoints and examples. Defaults to this request's origin, honoring X-Forwarded-Proto.

Returns

text/markdown

  • 200The generated markdown
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No readable subgraph by that name (SUBGRAPH_NOT_FOUND). Hosted: another account's private subgraph reads as missing
  • 429Hosted only: rate limited; retry after Retry-After seconds. Self-hosted reads are not rate limited

List deployed subgraphs

GET/api/subgraphsSelf-hosted instances
Open .md

Every subgraph on this instance with its status, sync progress, row count and open gap count. Row counts come from Postgres table statistics, so they are approximate; the detail read counts exactly.

Query parameters

healthinteger#

Also return each subgraph's hourly health for this many hours, the same shape as the health read. 1 to 168.

Returns

A cursor envelope. data holds Deployed subgraph objects.

  • 200Every deployed subgraph, unpaginated
  • 401This bind requires the instance token, and it was missing or wrong

Deploy or redeploy a subgraph

POST/api/subgraphsSelf-hosted instances
Open .md

Takes bundled handler code (see /api/subgraphs/bundle) plus the schema and sources extracted from it. The server reads the definition from the bundle without running it, validates it, lints print fields, then applies the schema. A new subgraph, or a breaking schema change, queues a reindex and returns its operationId. Redeploying the same name updates in place; action says what happened. With dryRun it returns the DDL plan and writes nothing.

Body

namestringrequired#

Subgraph name. Lowercase letters, digits and hyphens. Deploying an existing name updates it.

sourcesobjectrequired#

Event sources keyed by name, as read from the handler module. At least one.

schemaobjectrequired#

Table definitions keyed by table name.

handlerCodestringrequired#

The bundled handler module. 1 MB max.

startBlockinteger#

Overrides the definition's startBlock for this deploy and forces a reindex from it. Refused past the chain tip (START_BLOCK_PAST_TIP).

descriptionstring#

One line on what the subgraph indexes.

sourceCodestring#

The unbundled TypeScript source, kept so secondlayer subgraphs source can return it. 1 MB max.

dryRunboolean#

Validate and return the DDL plan without writing anything.

Returns

  • 200Redeployed in place (action is anything but created), or the dry-run plan when dryRun is set
  • 201Created. A reindex from start_block is queued; poll operationId
  • 400The body failed validation (here error is an object of field errors, not a string), the bundle could not be read (HANDLER_IMPORT_FAILED), the definition is invalid, or startBlock is past the chain tip (START_BLOCK_PAST_TIP)
  • 401This bind requires the instance token, and it was missing or wrong
  • 409A reindex or backfill is already queued or running for this subgraph (OPERATION_IN_PROGRESS). Wait for it, or stop it first.
  • 415Missing or non-JSON Content-Type (UNSUPPORTED_MEDIA_TYPE) — writes must send Content-Type: application/json
  • 422The definition deploys but would index wrong: a declared print field is never seen on-chain (PRINT_FIELD_MISMATCH), handlers write 0 rows against observed prints (EMPTY_MAPPING), a tip-first deploy has delta handlers (TIP_FIRST_NON_REPLAYABLE_HANDLER) or a breaking schema change (TIP_FIRST_BREAKING_CHANGE), or a subgraph with provable sources has a nondeterministic handler (NONDETERMINISTIC_HANDLER, with verification.reasons naming each use)

Bundle subgraph source into deployable handler code

POST/api/subgraphs/bundleSelf-hosted instances
Open .md

Compiles a TypeScript subgraph module on the server and returns the bundle plus the metadata read from it, ready to POST to /api/subgraphs. Deploys nothing. The CLI and MCP bundle locally; this is for callers that cannot run esbuild.

Body

codestringrequired#

The subgraph module's TypeScript source, with defineSubgraph as the default export.

Returns

The Subgraph bundle object.

  • 200Bundled
  • 400code is missing or empty, or the module did not compile (BUNDLE_FAILED)
  • 401This bind requires the instance token, and it was missing or wrong
  • 413The bundle exceeds the size limit (BUNDLE_TOO_LARGE); actualBytes and maxBytes say by how much
  • 415Missing or non-JSON Content-Type (UNSUPPORTED_MEDIA_TYPE) — writes must send Content-Type: application/json

Get a deployed subgraph

GET/api/subgraphs/{name}Self-hosted instances
Open .md

Definition, health, sync progress and per-table columns and exact row counts. While a reindex or backfill is active, sync carries its queue position, event progress and ETA.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

Returns

The Deployed subgraph detail object.

  • 200The subgraph
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name on this instance (SUBGRAPH_NOT_FOUND)

Delete a subgraph

DELETE/api/subgraphs/{name}Self-hosted instances
Open .md

Requests cancellation of any queued or running operation, waits up to 30 seconds for the processor to release it, then drops the Postgres schema and the registry row. Irreversible.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

Query parameters

forceboolean#

Accepted and logged. The delete proceeds after the 30-second wait either way.

Returns

  • 200Deleted
  • 400A parameter, filter, cursor or body field was refused; code says which
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name on this instance (SUBGRAPH_NOT_FOUND)
  • 415Missing or non-JSON Content-Type (UNSUPPORTED_MEDIA_TYPE) — writes must send Content-Type: application/json

Queue a full reindex

POST/api/subgraphs/{name}/reindexSelf-hosted instances
Open .md

Drops the subgraph's tables and rebuilds them from its start block to the chain tip. Takes no body. A fromBlock/toBlock is refused with 400 REINDEX_RANGE_NOT_SUPPORTED rather than ignored, since a ranged walk would destroy everything outside the range; use backfill for a range. Poll the returned operationId.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

Returns

The Queued operation object.

  • 200Reindex queued
  • 400The body carried fromBlock or toBlock (REINDEX_RANGE_NOT_SUPPORTED)
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name on this instance (SUBGRAPH_NOT_FOUND)
  • 409A reindex or backfill is already queued or running for this subgraph (OPERATION_IN_PROGRESS). Wait for it, or stop it first.
  • 415Missing or non-JSON Content-Type (UNSUPPORTED_MEDIA_TYPE) — writes must send Content-Type: application/json

Queue a backfill over a block range

POST/api/subgraphs/{name}/backfillSelf-hosted instances
Open .md

Re-runs handlers over fromBlock to toBlock, inclusive, without dropping data. A backfill that overlaps an earlier failed or cancelled one resumes from its last committed block. Refused when the handlers apply deltas (ctx.increment, ctx.update) or read-modify-write rows (ctx.findOne, ctx.findMany), which would double-count blocks already processed; reindex those instead.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

Body

fromBlockintegerrequired#

First block height to re-run, inclusive.

toBlockintegerrequired#

Last block height to re-run, inclusive.

Returns

The Queued operation object.

  • 200Backfill queued
  • 400fromBlock or toBlock is missing, not a number, or 0 (VALIDATION_ERROR)
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name on this instance (SUBGRAPH_NOT_FOUND)
  • 409A reindex or backfill is already queued or running for this subgraph (OPERATION_IN_PROGRESS). Wait for it, or stop it first.
  • 415Missing or non-JSON Content-Type (UNSUPPORTED_MEDIA_TYPE) — writes must send Content-Type: application/json
  • 422The handlers apply deltas and cannot be replayed (BACKFILL_NON_REPLAYABLE_HANDLER)

Stop the active reindex or backfill

POST/api/subgraphs/{name}/stopSelf-hosted instances
Open .md

Takes no body. Flags the queued or running operation for cancellation; the processor stops it at its next checkpoint and marks it cancelled. A stopped backfill resumes from its checkpoint when the same range is queued again.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

Returns

  • 200Stop requested
  • 400A parameter, filter, cursor or body field was refused; code says which
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name (SUBGRAPH_NOT_FOUND), or nothing queued or running to stop (NO_OPERATION)
  • 415Missing or non-JSON Content-Type (UNSUPPORTED_MEDIA_TYPE) — writes must send Content-Type: application/json

List a subgraph's operations

GET/api/subgraphs/{name}/operationsSelf-hosted instances
Open .md

The 20 most recent reindex and backfill operations, newest first, with progress. Queued ones carry an approximate queuePosition.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

Returns

A cursor envelope. operations holds Subgraph operation objects.

  • 200Recent operations
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name on this instance (SUBGRAPH_NOT_FOUND)

Get an operation

GET/api/subgraphs/{name}/operations/{operation_id}Self-hosted instances
Open .md

One reindex or backfill by id. Poll it after a deploy, reindex or backfill until status is completed, failed or cancelled.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

operation_idstringrequired#

Operation id (UUID) from a deploy, reindex or backfill response, or from the operations list.

Returns

The Subgraph operation object.

  • 200The operation
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name (SUBGRAPH_NOT_FOUND), or no operation with this id on it (OPERATION_NOT_FOUND)

List a subgraph's gaps

GET/api/subgraphs/{name}/gapsSelf-hosted instances
Open .md

Block ranges the subgraph failed to process, ordered by start height. Open gaps only by default.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

Filters

_offsetinteger#

Gaps to skip. Default 0.

resolvedenum#

true or all include resolved gaps with the open ones. Omit for open gaps only.

2 possible values
trueall

Range and paging

_limitinteger#

Page size, 1 to 1000. Default 50.

Returns

A cursor envelope. data holds Subgraph gap objects.

  • 200A page of gaps
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name on this instance (SUBGRAPH_NOT_FOUND)

Get a subgraph's hourly health

GET/api/subgraphs/{name}/healthSelf-hosted instances
Open .md

Hourly buckets from the snapshot the subgraph records every minute: blocks behind the chain tip, rows written, handler errors and events handled. Snapshots are kept 7 days. Oldest hour first; an hour with no snapshots has lagBlocks: null and zero counts.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

Query parameters

hoursinteger#

Hours to return, 1 to 168. Default 24.

Returns

The Subgraph health object.

  • 200Hourly health
  • 400hours is not an integer from 1 to 168 (VALIDATION_ERROR)
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name on this instance (SUBGRAPH_NOT_FOUND)

List a subgraph's handler errors

GET/api/subgraphs/{name}/errorsSelf-hosted instances
Open .md

Handler errors grouped by message and stack frame, most frequent first. A bug that throws on every event is one group with a count, plus a sample transaction to reproduce it.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

Range and paging

limitinteger#

Groups to return, 1 to 50. Default 20.

Returns

  • 200Error groups
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name on this instance (SUBGRAPH_NOT_FOUND)

List a subgraph's print violations

GET/api/subgraphs/{name}/violationsSelf-hosted instances
Open .md

Print events a handler skipped because the payload did not match the source's declared prints schema, newest first. The instance keeps the last 100 per subgraph.

Path parameters

namestringrequired#

Subgraph name, as deployed. Lowercase letters, digits and hyphens.

Range and paging

limitinteger#

Page size, 1 to 100. Default 50.

Returns

A cursor envelope. data holds Print validation skip objects.

  • 200Recent violations
  • 401This bind requires the instance token, and it was missing or wrong
  • 404No subgraph by this name on this instance (SUBGRAPH_NOT_FOUND)
Open .md

Returned by List the subgraphs this instance serves

Attributes

subgraphsarray of SubgraphSummaryrequired#

Every subgraph you can read. Not paginated.

tipobjectrequired#

The chain tip this list was read against.

envelopeobjectrequired#

Fixed reminder of the row-read shape and cursor rules, for agents reading the directory cold.

Open .md

Metadata for one subgraph.

Returned by Get one subgraph's tables, columns, and sync tip

Attributes

namestring#

Subgraph name.

descriptionstring · nullable#

The definition's description, if it has one.

versionstring#

Deployed version.

statusstring#

Indexing state: active (following the chain), reindexing, paused, or error.

created_atstring · date-time#

First deploy.

sourcesarray of string#

Contracts the definition reads from: each source's contractId, and the contract half of each assetIdentifier.

start_blockinteger#

Block indexing starts from. 0 means genesis.

tablesobject#

Each table by name.

tipSubgraphTip#
docsobject#

Generated docs for this subgraph.

Open .md

OpenAPI 3.1 document generated from the definition.

Returned by Get a subgraph's OpenAPI document

Attributes

openapistring#

Always 3.1.0.

infoobject#

Title, the subgraph's version, and its description.

serversarray of object#

The server param, or this request's origin.

pathsobject#

A list path and a count path per table.

componentsobject#

A <table>Row schema per table.

x-secondlayer-subgraphstring#

Subgraph name.

x-secondlayer-versionstring#

Deployed version.

x-secondlayer-schema-hashstring#

sha256 of the definition's name, schema and sources. Changes only when they do.

x-secondlayer-pinstring#

sha256 over the schema hash, bundled handler, startBlock, network and runtime. Absent for subgraphs deployed before pins existed.

x-secondlayer-generated-atstring · date-time#

When this document was generated.

x-secondlayer-sourcesobject#

The definition's sources, as written.

x-secondlayer-tablesarray of string#

Table names.

Open .md

Compact description of a subgraph for agents and tools.

Returned by Get a subgraph's agent schema

Attributes

namestring#

Subgraph name.

versionstring#

Deployed version.

descriptionstring#

The definition's description. Absent without one.

schemaHashstring#

sha256 of the definition's name, schema and sources.

pinstring#

sha256 over the schema hash, bundled handler, startBlock, network and runtime.

generatedAtstring · date-time#

When this schema was generated.

serverUrlstring#

The server param, or this request's origin.

sourcesobject#

The definition's sources, as written.

tablesobject#

Per table: absolute endpoints, exact rowCount, columns including system columns, accepted query params and filters, and example requests.

Open .md

One page of rows from GET /v1/subgraphs/{name}/{table}.

Returned by List a table's rows

Attributes

rowsarray of SubgraphRowrequired#

The page, in _id order or _sort order.

next_cursorstring · nullablerequired#

Pass back as cursor to resume after this page. Set on every page that returned rows, including a short last page; null only on an empty page, which means you are caught up. To tail, keep the last cursor you got: cursor = next_cursor ?? cursor. Without _sort it is the last row's _id; with _sort it is an opaque token.

tipSubgraphTiprequired#
Open .md

Returned by Count a table's rows

Attributes

countintegerrequired#

Rows matching the filters, or the planner's estimate for an unfiltered _count=estimate.

Open .md

Only the aggregates you asked for are present. Sums, minimums and maximums are strings so large values stay exact.

Returned by Aggregate a table's rows

Attributes

countinteger#

Rows matching the filters. Present with _count, or when no other aggregate was asked for.

countDistinctobject#

Distinct values per _countDistinct column.

sumobject#

Sum per _sum column. "0" over no rows.

minobject#

Minimum per _min column. null over no rows.

maxobject#

Maximum per _max column. null over no rows.

Open .md

One deployed subgraph, as the list returns it.

Returned by List deployed subgraphs

Attributes

namestringrequired#

Subgraph name.

versionstringrequired#

Deployed version.

statusenumrequired#

Processor state.

4 possible values
activereindexingpausederror
lastProcessedBlockintegerrequired#

Highest block processed.

totalProcessedintegerrequired#

Events handled since deploy.

totalRowsinteger#

Approximate rows across tables, from table statistics.

totalErrorsintegerrequired#

Handler errors since deploy.

tablesarray of stringrequired#

Table names.

chainTipintegerrequired#

Progress denominator: the chain tip, or the reindex target while reindexing.

sourceChainTipinteger#

The instance's chain tip.

targetBlockinteger#

Height this sync or reindex is walking toward.

progressnumber · 0 to 1required#

Fraction of blocks processed, 0 to 1.

blocksRemaininginteger#

Blocks left to targetBlock.

syncModeenum#

reindex while a reindex walk runs.

2 possible values
syncreindex
gapCountintegerrequired#

Open gaps.

integrityenumrequired#

gaps_detected when any gap is open.

2 possible values
completegaps_detected
lastErrorstring · nullable#

Most recent processing error.

lastErrorAtstring · date-time · nullable#

When it happened.

updatedAtstring · date-time · nullable#

Last registry update.

createdAtstring · date-timerequired#

First deploy.

healthSubgraphHealth#

Hourly health, present only when the list is requested with health.

Open .md

A compiled subgraph. Everything but ok and bundleSize is the body for POST /api/subgraphs.

Returned by Bundle subgraph source into deployable handler code

Attributes

okenumrequired#

Always true.

1 possible values
true
namestringrequired#

Name from the definition.

descriptionstring · nullable#

Description from the definition, if set.

sourcesobjectrequired#

Event sources by name.

schemaobjectrequired#

Table definitions by name.

handlerCodestringrequired#

The bundled handler module.

sourceCodestringrequired#

The code you sent, echoed back.

bundleSizeintegerrequired#

Size of handlerCode in bytes.

Open .md

One deployed subgraph in full.

Returned by Get a deployed subgraph

Attributes

namestringrequired#

Subgraph name.

versionstringrequired#

Deployed version.

schemaHashstring#

Hash of the table schema. Changes when the schema does.

pinstring · nullable#

Hash of everything that shapes rows: schema hash, bundled handler, startBlock, network, runtime. Null for subgraphs deployed before pins existed.

verificationobject#

Derived verification level. Null for subgraphs deployed before levels were derived.

statusenumrequired#

Processor state.

4 possible values
activereindexingpausederror
lastProcessedBlockintegerrequired#

Highest block processed.

descriptionstring#

From the definition, when set.

sourcesobject#

Event sources by name, from the definition.

definitionobject · nullable#

The stored definition: name, description, startBlock, sources, schema.

healthobjectrequired#

totalProcessed and totalErrors since deploy, errorRate, the last error and when, emptyMapping (events matched but every table is empty), and violationCount (print violations kept).

syncDeployedSubgraphSyncrequired#
tablesobjectrequired#

By table name: read endpoint, columns (with the system columns _id, _block_height, _tx_id, _created_at), exact rowCount, an example query, and indexes and uniqueKeys when declared.

createdAtstring · date-timerequired#

First deploy.

updatedAtstring · date-timerequired#

Last registry update.

Open .md

A reindex or backfill accepted into the queue.

Returned by Queue a full reindex, Queue a backfill over a block range

Attributes

messagestringrequired#

One-line summary.

fromBlockintegerrequired#

First block. For a reindex, the subgraph's start block.

toBlockintegerrequired#

Last block. For a reindex, the string "chain tip": it runs to whatever the tip is when it gets there.

operationIdstring · uuidrequired#

Poll /api/subgraphs/{name}/operations/{operation_id}.

statusenumrequired#

Always queued.

1 possible values
queued
Open .md

A reindex or backfill. One per subgraph can be queued or running at a time.

Returned by List a subgraph's operations, Get an operation

Attributes

idstring · uuidrequired#

Operation id.

subgraphNamestringrequired#

Subgraph it runs on.

kindenumrequired#

reindex drops and rebuilds; backfill re-runs a range in place.

2 possible values
reindexbackfill
statusenumrequired#

queued until a processor claims it. completed, failed and cancelled are final.

5 possible values
queuedrunningcompletedfailedcancelled
weightenumrequired#

light for contract-scoped sources, heavy for broad ones. The processor limits how many heavy operations run at once.

2 possible values
lightheavy
fromBlockinteger · nullable#

First block. null on a reindex queued from /reindex, which starts at the subgraph's start block.

toBlockinteger · nullable#

Last block. null means the chain tip.

processedBlocksinteger · nullable#

Blocks covered. Set when the operation finishes.

cursorBlockinteger · nullable#

Backfills only: last committed block. A requeued backfill resumes after it.

estimatedEventsinteger · nullable#

Events expected, computed at enqueue for contract-scoped sources.

processedEventsinteger · nullable#

Events processed so far.

progressnumber · 0 to 1 · nullablerequired#

Fraction done, 0 to 1, from events when estimated, else blocks. null before any progress is reported.

queuePositioninteger#

Queued only: approximate 1-based position. Show it as ~N.

errorstring · nullable#

Why it failed.

startedAtstring · date-time · nullable#

When a processor claimed it.

finishedAtstring · date-time · nullable#

When it reached a final status.

createdAtstring · date-timerequired#

When it was queued.

updatedAtstring · date-timerequired#

Last change.

Open .md

A block range the subgraph did not process.

Returned by List a subgraph's gaps

Attributes

startintegerrequired#

First missing block.

endintegerrequired#

Last missing block, inclusive.

sizeintegerrequired#

Blocks in the range.

reasonenumrequired#

block_missing: the block was not in the index. processing_error: a handler threw.

2 possible values
block_missingprocessing_error
detectedAtstring · date-timerequired#

When it was recorded.

resolvedAtstring · date-time · nullablerequired#

When a later walk covered it. null while open.

Open .md

Hourly health buckets and the newest 24 hours' handler errors.

Returned by Get a subgraph's hourly health

Attributes

hoursarray of objectrequired#

One bucket per hour, oldest first.

errors24hintegerrequired#

Handler errors across the newest 24 hours.

Open .md

A print event skipped because its payload did not match the declared prints schema.

Returned by List a subgraph's print violations

Attributes

idstring · uuidrequired#

Violation id.

sourceNamestringrequired#

Source whose prints schema refused it.

blockHeightintegerrequired#

Block of the event.

txIdstringrequired#

Transaction of the event.

reasonstringrequired#

Which field was missing or had the wrong type.

samplePayloadobjectrequired#

The decoded print, as topic and data.

seenAtstring · date-timerequired#

When it was skipped.

Edit on GitHub