The Graph (Subgraph) API
The Graph (Subgraph) API
The Graph is a decentralized Web3 data indexing network — query blockchain data via GraphQL via subgraphs deployed by developers with various data schemas.
Decentralized (no single provider dependency)
Steep learning curve (must understand subgraph manifest + AssemblyScript handlers)
Create API key at thegraph.com/studio. POST GraphQL query to https://gateway-arbitrum.network.thegraph.com/api/{API_KEY}/subgraphs/id/{SUBGRAPH_ID}
Uptime · 30-day window
About this API
The Graph is Web3's "Google Indexing" — indexing raw on-chain transaction, contract event data into schemas (subgraphs) queryable via GraphQL. Background: using plain Ethereum RPC to query "Uniswap's 30-day pool swap totals" requires scanning millions of events — slow and expensive; with Uniswap's official subgraph, one GraphQL query returns results. All major DeFi protocols (Uniswap, Aave, Compound, Curve, Sushi) have official subgraphs; NFT collections have third-party subgraphs. The Graph network is decentralized — subgraphs hosted by community indexer nodes; developers pay queries with GRT tokens. Free tier 100k queries/month works for small projects. Hosted Service (centralized) was deprecated in 2024; must use Decentralized Network.
What you can build
- 1DeFi protocol data dashboards
- 2NFT collection analytics
- 3Decentralized DApp backends
- 4Web3 data indexing without reinventing
Strengths & limitations
Strengths
- Decentralized (no single provider dependency)
- GraphQL more flexible than RPC
- Rich subgraph ecosystem (Uniswap, Aave, Compound all have official subgraphs)
Limitations
- Steep learning curve (must understand subgraph manifest + AssemblyScript handlers)
- Hosted Service deprecated; must use Decentralized Network
- Some subgraphs index slowly
Example request
curl https://thegraph.com/<endpoint> \
-H "Authorization: Bearer $API_KEY"
# Some providers use X-Api-Key instead — verify in the docs.Getting started
Create API key at thegraph.com/studio. POST GraphQL query to https://gateway-arbitrum.network.thegraph.com/api/{API_KEY}/subgraphs/id/{SUBGRAPH_ID}
FAQ
What if no ready-made subgraph exists?+
Write and deploy your own. Steep learning curve (subgraph manifest + handlers) but official tutorials exist.
How are GRT tokens used?+
Pay via Studio/Gateway. $10 GRT typically buys hundreds of thousands of queries.
Technical details
- Auth type
- api_key
- Pricing
- freemium
- Rate limit
- free 100k queries/月;超额按 GRT 代币计费
- Protocols
- GraphQL
- SDKs
- javascript, typescript, python
- Response time
- 143 ms
- Last health check
- 5/12/2026, 7:38:29 AM