GraphQL Endpoint
All GraphQL queries are sent to a single endpoint:
https://graphql.chainstream.io/graphql
Both POST and GET methods are supported.
Method Content-Type Use 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.
Get your API Key from ChainStream Dashboard → Applications → Create New App . The key starts with cs_live_....
Header Value Required Content-Typeapplication/jsonYes (POST) X-API-KEYcs_live_...Yes
A GraphQL request body is a JSON object with two fields:
Field Type Description querystringThe GraphQL query or mutation string variablesobjectOptional variables referenced in the query via $variable syntax
POST Example
cURL
cURL (query file)
JavaScript (fetch)
Python (requests)
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" }
}'
For complex queries, save the query to a file and reference it: # Save query to file
cat > query.graphql << 'EOF'
query ($network: Network!) {
DEXTrades(network: $network, limit: {count: 5}) {
Block { Time }
Trade {
Buy {
Currency { MintAddress }
Amount
}
}
}
}
EOF
# Send with variables
curl -X POST "https://graphql.chainstream.io/graphql" \
-H "Content-Type: application/json" \
-H "X-API-KEY: your_api_key" \
-d "{ \" query \" : \" $( cat query.graphql | tr '\n' ' ') \" , \" variables \" : { \" network \" : \" sol \" }}"
const response = await fetch ( "https://graphql.chainstream.io/graphql" , {
method: "POST" ,
headers: {
"Content-Type" : "application/json" ,
"X-API-KEY" : "your_api_key" ,
},
body: JSON . stringify ({
query: `query ($network: Network!) {
DEXTrades(network: $network, limit: {count: 5}) {
Block { Time }
Trade { Buy { Currency { MintAddress } Amount } }
}
}` ,
variables: { network: "sol" },
}),
});
const { data , extensions } = await response . json ();
console . log ( data . DEXTrades );
import requests
resp = requests.post(
"https://graphql.chainstream.io/graphql" ,
headers = {
"Content-Type" : "application/json" ,
"X-API-KEY" : "your_api_key" ,
},
json = {
"query" : """query ($network: Network!) {
DEXTrades(network: $network, limit: {count: 5} ) {
Block { Time }
Trade { Buy { Currency { MintAddress } Amount } }
}
}""" ,
"variables" : { "network" : "sol" },
},
)
data = resp.json()
print (data[ "data" ][ "DEXTrades" ])
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 Enum Blockchain Chain ID solSolana — ethEthereum 1 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 }) { ... } }
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 }
]
}
}
}
Field Description 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.