PayQL — pay-per-query data from The Graph
Get live on-chain data from The Graph's subgraphs (DeFi, DEX pools, NFTs, ENS, tokens, governance — 15,000+ subgraphs across 20+ chains), paying ~$0.01 USDC per query over x402. No API key, no account, no ETH for gas — the payment is the auth, and it's gasless (EIP-3009 transferWithAuthorization on Base).
The loop: discover → price → query
- Discover the right live subgraph for a protocol — ranked by on-chain curation signal, so you skip dead forks.
- Price it — preflight the
402challenge to read the exact USDC cost before paying (free). - Query — send GraphQL, pay the
402from your wallet, get the data + a receipt back.
Two ways to run it
A. PayQL MCP server (turnkey)
Install and wire into your harness (Claude Desktop / Code / Cursor):
{
"mcpServers": {
"payql": {
"command": "npx",
"args": ["-y", "payql"],
"env": { "PAYQL_NETWORK": "base", "PAYQL_PRIVATE_KEY": "0xYOUR_BASE_WALLET_KEY" }
}
}
}
Tools: search_subgraphs, get_payment_info (free price quote), query_subgraph (paid), get_subgraph_schema, wallet_status. Full recipe + example queries in references/gateway.md.
B. No install — use your harness's own wallet
If your harness already has an x402 / pay-for-service capability, hit the gateway directly:
- Gateway URL:
https://gateway.thegraph.com/api/x402/subgraphs/id/<SUBGRAPH_ID> - POST GraphQL
{"query":"..."}. On402, pay the quoted USDC amount and retry — your x402 client does this automatically.
Full no-install recipe (discovery query, pricing, examples) in references/gateway.md.
Wallet & funding
Fund a Base wallet with USDC only — payments are gasless, so no ETH is required. Want spend caps/allowlists? Use an Ampersend-managed wallet (see the PayQL README). The per-query cost is $0.01 — there are no API keys, subscriptions, or platform fees; the x402 micropayment is the only cost.
