Skip to main content

Legacy query compatibility

Compatibility reference for existing GraphQL API and MCP query consumers. Use REST or MCP discovery for new integrations.

Last updated

Website editor retired

The GraphQL website editor has been retired. Use the REST API reference or MCP for new integrations. Existing API queries, subscriptions, and the MCP query_graphql tool remain available; their compatibility limits are documented below.

Endpoint

POST a GraphQL document. GET returns the published SDL. Introspection is enabled. Mainnet-only path.

POST/GET https://api.metagraph.sh/api/v1/graphql

GraphQL isn't part of the typed @jsonbored/metagraphed / metagraphed SDKs — they're built around the REST envelope. Plain HTTP works with any client:

curl -X POST https://api.metagraph.sh/api/v1/graphql \
  -H 'content-type: application/json' \
  -d '{"query":"{ subnet(netuid: 7) { name health { status } surfaces { kind url } economics { emission_share } } }"}'

Schema

GET the endpoint for the live SDL. Introspection queries (__schema / __type) are allowed and exempt from the depth and complexity budgets applied to product queries.

  • GET /api/v1/graphql → SDL document
  • POST /api/v1/graphql → { "query", "variables?", "operationName?" }
  • Field names mirror artifact JSON keys (snake_case) so resolvers read registry rows directly.

Root queries

Ten Query roots cover the same registry surfaces as REST. List roots take cursor pagination; relationship fields (fresh nested artifacts) cost more against the complexity budget.

FieldArgsReturnsSummary
subnetslimit, cursorSubnetList!Paginated active-subnet index.
subnetnetuid!SubnetOne subnet with health, surfaces, endpoints, and economics.
providerslimit, cursorProviderList!Paginated provider/source registry.
providerid!ProviderOne provider with its subnets.
economicslimit, cursorEconomicsList!Paginated per-subnet economic + validator metrics.
surfacesnetuid, limit, cursorSurfaceList!Curated public surfaces, optionally scoped to one subnet.
endpointsnetuid, limit, cursorEndpointList!Endpoint/resource registry, optionally scoped to one subnet.
health—GlobalHealthGlobal operational health rollup with per-subnet summaries.
opportunity_boardslimitOpportunityBoards!Cross-subnet economic opportunity boards.
comparenetuids!, dimensionsCompare!Side-by-side registry / economics / health for requested netuids.

Subscriptions: chainEvents over the same path via graphql-transport-ws (WebSocket). See For agents for other machine surfaces.

Limits

Hard caps enforced on every POST. Matching constants live in src/graphql.ts; rate limiting is keyed per client IP alongside the RPC proxy.

LimitValueNotes
Max depth7Nested selection sets beyond this fail validation.
Max complexity50Default field cost 1; relationship roots cost 5.
Max POST body64 KiBHTTP request body size cap for POST /api/v1/graphql.
Max query document16 KiBRaw query string / document length cap.
Page size20 default · 100 maxCursor pagination on list roots (subnets, providers, …).
Rate limit100 / 60sPer-client IP, shared policy with the RPC proxy (429 + retry-after).