Skip to main content
Graph Node exposes a powerful GraphQL API for querying indexed blockchain data from subgraphs. The API automatically generates query types based on your subgraph schema and provides advanced filtering, sorting, and pagination capabilities.

API Endpoint

Once Graph Node is running, the GraphQL HTTP server is available at:
You can query specific subgraphs using these URL patterns:

Schema-Based Type Generation

Graph Node automatically generates GraphQL query types from your subgraph schema. For each entity type in your schema, the API provides:
  • Single entity query: entityName(id: ID!): EntityType
  • Collection query: entityNames(first, skip, orderBy, orderDirection, where): [EntityType!]!

Example Schema

schema.graphql

Generated Query Types

From the schema above, Graph Node generates:
Generated API

Entity Types and Fields

Supported GraphQL Types

Graph Node supports the following scalar types in entity definitions:
String
Unique identifier for entities. Stored as text or bytea in PostgreSQL.
String
UTF-8 encoded text strings.
Bytes
Byte arrays, typically for Ethereum addresses and hashes. Must be prefixed with 0x.
Int
32-bit signed integer.
Int8
64-bit signed integer.
BigInt
Arbitrary precision integer, stored as PostgreSQL numeric.
BigDecimal
Arbitrary precision decimal, stored as PostgreSQL numeric.
Boolean
Boolean value (true or false).
Timestamp
Unix timestamp in microseconds since epoch. Available from spec version 1.1.0.

Entity Attributes

Marks a GraphQL type as a storable entity.
Options:
  • immutable: true - Entity versions are never updated (optimized storage)
  • timeseries: true - Entity is a timeseries data point (immutable with timestamp)
Creates reverse lookups for entity relationships.
The transfers field on Token is automatically populated from Transfer entities.
Immutable entities are write-once and never updated, enabling storage optimizations.
Storage Optimization:
  • Uses block$ column instead of block_range
  • Simple BTree indexes instead of GiST indexes
  • Enforces unique(id) constraint

Query Arguments

All collection queries support these arguments:
Int
default:"100"
Number of entities to return. Maximum value is configurable per Graph Node instance.
Int
default:"0"
Number of entities to skip. Useful for pagination.
Enum
Field to sort results by. Can be any field in the entity or nested field (e.g., token__symbol).
Enum
Sort direction: asc (ascending) or desc (descending). Default is asc.
Filter
Filter conditions for entities. See Query Filters for details.
Block_height
Query historical state at a specific block. See Time-Travel Queries.

Basic Query Examples

Response Format

Graph Node returns responses in standard GraphQL format:

Error Handling

Errors are returned in the errors array:

Interfaces

Graph Node supports GraphQL interfaces for polymorphic entities:
Query interfaces to fetch all implementing types:

Performance Considerations

Always use first and skip for pagination to avoid loading excessive data:
Only query fields you need. Large text fields and arrays can be expensive:
Be cautious with nested queries that can multiply data fetched:

Next Steps