The Graph API

Blockchain / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

The Graph is a decentralized indexing protocol that lets you query Ethereum and other blockchain networks using GraphQL. Use it to build dApps that need fast, structured access to on-chain data without running your own node.

💡

Beginner Tip

You query subgraphs via GraphQL, not REST — start with a publicly deployed subgraph on the hosted service before creating your own. Use the Graph Explorer at thegraph.com/explorer to find existing subgraphs.

Available Data

The Graph data via REST API
JSON-formatted response data
Requires API key authentication

Example Response

JSON Response
{
  "id": "bitcoin",
  "symbol": "btc",
  "current_price": 65432.1,
  "market_cap": 1280000000000,
  "price_change_24h": 1250.5,
  "price_change_percentage_24h": 1.95,
  "total_volume": 28500000000
}

Field Reference

data Root wrapper containing your queried GraphQL entity results
data.pools List of liquidity pool entities matching the query filters
data.pools[].id Unique on-chain address of the liquidity pool contract
data.pools[].token0 First token in the trading pair, with symbol and decimals
data.pools[].token1 Second token in the trading pair, with symbol and decimals
errors Present only on failure; each item has a message describing the GraphQL error

Implementation Example

const url = "https://thegraph.com/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

401 Unauthorized Missing or invalid API key in the Authorization header
Pass your key as 'Authorization: Bearer YOUR_API_KEY' in the request headers
GraphQL field not found error Querying fields that do not exist in the subgraph schema
Open the subgraph in Graph Explorer, check the schema tab, and query only listed entity fields
Empty data response The subgraph has not finished indexing or the entity has no matching records
Check the subgraph sync status in Explorer; filter your query with 'first: 10' to test with a small result set

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Blockchain
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →