Query an existing Subgraph and check how recently its data was indexed. This example reads the
five largest pools by total value locked from a Uniswap-style schema and includes _meta for
indexing information.
Expected result: five pools and the indexed block in _meta. Your endpoint can return
different pools and values as indexing advances.
Use a deployment that exposes pools, token0, token1, and totalValueLockedUSD, or adapt the
query to your Subgraph's schema. Replace
<UNISWAP_DEPLOYMENT_CID> with its Deployment CID, not a Graph Network Subgraph ID.
Prerequisites
- A GraphOps Platform account.
- An organization with access to Subgraphs.
- An Owner or Developer role to create a Subgraphs API key, or a key supplied by your team.
- A public Deployment CID for a Subgraph with the fields used in this example.
Create an API key
Create a Subgraphs API key(opens in a new tab)Choose your organization, create the key for Subgraphs, and store the plaintext value in your secret manager.
Choose the deployment
Use the Deployment CID published by the Subgraph owner or returned by your Graph CLI deployment. To find a public dataset and its current Deployment CID, search Discover Subgraphs. The deployment endpoint stays on that version even if the owner publishes an upgrade.
If you want to follow the owner's upgrades, use the separate subgraphId endpoint described in
Identifiers and Endpoint Aliases.
Query the deployment
Run a GraphQL query against the Deployment CID endpoint.
Prerequisites
Set GRAPHOPS_API_KEY to your GraphOps API key.
Replace <UNISWAP_DEPLOYMENT_CID> with the Deployment CID of a Uniswap-style Subgraph.
curl
curl --fail-with-body --silent --show-error "https://subgraphs.graphops.xyz/v1/deploymentCID/<UNISWAP_DEPLOYMENT_CID>" \
-H "Authorization: Bearer ${GRAPHOPS_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"query": "query TopPools { pools(first: 5, orderBy: totalValueLockedUSD, orderDirection: desc) { id token0 { symbol } token1 { symbol } totalValueLockedUSD } _meta { block { number hash } hasIndexingErrors } }"
}'
Output
{ "data": { "pools": [The entities your query selected { "id": "0x277667eb3e34f134adf870be9550e9f323d0dc24", "token0": { "symbol": "ease.org" }, "token1": { "symbol": "ez-cvxsteCRV" }, "totalValueLockedUSD": "1110167010695.785900004139211677005" }, { "id": "0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51", "token0": { "symbol": "ease.org" }, "token1": { "symbol": "ez-yvCurve-IronBank" }, "totalValueLockedUSD": "1432077483.208630196467118329099649" }, { "id": "0x055284a4ca6532ecc219ac06b577d540c686669d", "token0": { "symbol": "ease.org" }, "token1": { "symbol": "ez-SLP-WBTC-WETH" }, "totalValueLockedUSD": "1322031013.848042060988788389158996" }, { "id": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", "token0": { "symbol": "USDC" }, "token1": { "symbol": "WETH" }, "totalValueLockedUSD": "386118995.3847330522079714597097742" }, { "id": "0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8", "token0": { "symbol": "USDC" }, "token1": { "symbol": "WETH" }, "totalValueLockedUSD": "323911620.9673445366545239684858282" } ], "_meta": {Indexing state behind this result "block": { "number": 26250896,Highest indexed block served "hash": "0x82e545cf75fa0740c6b6f7dbb6204f0fc11569dc63a87a6412b74d8cd242b961" }, "hasIndexingErrors": falseCheck before trusting the data } }}GraphQL reports query problems in an errors array, often with HTTP status 200. If the response
has errors instead of data, compare the field names with the deployment's schema in
Schema reference. For 401 or 404 responses, see
Troubleshooting.