Skip to main content

GraphQL Endpoint

All GraphQL queries are sent to a single endpoint:
https://graphql.chainstream.io/graphql
Both POST and GET methods are supported.
MethodContent-TypeUse Case
POSTapplication/jsonRecommended for all queries — supports variables and complex queries
GETQuery string (?query=...)Simple queries, browser testing, caching-friendly
Use POST for production workloads. GET requests encode the query in the URL, which has length limits and makes complex queries unwieldy.

Authentication

Authenticate by passing your API Key in the X-API-KEY header. This is the same API Key used for the REST Data API — no separate credentials needed.
X-API-KEY: your_api_key
Get your API Key from ChainStream DashboardApplicationsCreate New App. The key starts with cs_live_....

Required Headers

HeaderValueRequired
Content-Typeapplication/jsonYes (POST)
X-API-KEYcs_live_...Yes

Request Format

A GraphQL request body is a JSON object with two fields:
FieldTypeDescription
querystringThe GraphQL query or mutation string
variablesobjectOptional variables referenced in the query via $variable syntax

POST Example

curl -X POST "https://graphql.chainstream.io/graphql" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: your_api_key" \
  -d '{
    "query": "query ($network: Network!) { DEXTrades(network: $network, limit: {count: 5}) { Block { Time } Trade { Buy { Currency { MintAddress } Amount } } } }",
    "variables": { "network": "sol" }
  }'

GET Example

curl -G "https://graphql.chainstream.io/graphql" \
  -H "X-API-KEY: your_api_key" \
  --data-urlencode 'query={ DEXTrades(network: sol, limit: {count: 5}) { Block { Time } } }'

Supported Networks

Pass the network argument as an enum value on every top-level Cube query:
Network EnumBlockchainChain ID
solSolana
ethEthereum1
bscBNB Chain (BSC)56
# Solana
{ DEXTrades(network: sol, limit: {count: 5}) { ... } }

# Ethereum
{ DEXTrades(network: eth, limit: {count: 5}) { ... } }

# BSC
{ DEXTrades(network: bsc, limit: {count: 5}) { ... } }

Response Format

All responses are JSON with the following structure:
{
  "data": {
    "DEXTrades": [
      { "Block": { "Time": "2025-03-27T10:15:30Z" }, "..." : "..." }
    ]
  },
  "extensions": {
    "credits": {
      "total": 50,
      "cubes": [
        { "cube": "DEXTrades", "credits": 50, "row_count": 5 }
      ]
    }
  }
}
FieldDescription
dataThe query result — matches the shape of your query
errorsPresent only when there are validation or execution errors
extensions.credits.totalTotal credit units consumed by this query
extensions.credits.cubesPer-Cube breakdown: Cube name, credits charged, and rows returned
The extensions.credits field is included when credits are consumed. See Billing & Credits for details on how credits are calculated.

Error Response

When a query is malformed or fails, the response includes an errors array:
{
  "data": null,
  "errors": [
    {
      "message": "Unknown field 'InvalidField' on type 'DEXTrades'",
      "locations": [{ "line": 3, "column": 5 }]
    }
  ]
}
Use the GraphQL IDE to validate queries interactively before integrating them into your application. The IDE provides auto-complete and inline error highlighting.

Next Steps

Run Your First Query

Follow the step-by-step tutorial to run a real query from the IDE or cURL.

Explore the Schema

Dive into the 25 Cubes, field types, filtering operators, and aggregation functions.