GraphQL API Debugging Guide

Queries, variables, operation names, validation failures, partial data and HTTP behavior. Last updated August 31, 2026.

The GraphQL specification separates request errors from execution errors and describes how responses may contain data, errors and implementation-specific extensions. See the current GraphQL spec at spec.graphql.org. The GraphQL-over-HTTP draft also gives practical HTTP status recommendations for parse errors, validation failures, auth failures and server failures at graphql-over-http.

Minimal curl request

curl -i -X POST https://api.example.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer REPLACE_WITH_TEST_TOKEN" \
  --data '{"query":"query Viewer { viewer { id login } }"}'

Query with variables

{
  "operationName": "CustomerById",
  "query": "query CustomerById($id: ID!) { customer(id: $id) { id name email } }",
  "variables": {
    "id": "cus_123"
  }
}

Use the JSON Formatter before debugging variables. Many GraphQL failures start as ordinary JSON body mistakes: wrong variable shape, missing operationName, invalid string escaping or stale copied payloads.

Error classification

SymptomLikely layerNext check
Invalid JSON bodyHTTP transportFormat the request body and inspect Content-Type.
GraphQL parse errorQuery documentCheck braces, field syntax and copied fragments.
Validation errorSchema contractCheck field names, argument names and variable types.
Auth errorToken or policyCheck bearer token, scopes, viewer identity and field-level authorization.
Partial data with errorsResolver executionInspect error path, nullable fields and downstream service logs.

Debug checklist

endpoint:
operation name:
query hash:
variables valid JSON:
auth token scope:
http status:
data present:
errors present:
first error message:
error path:
resolver owner:
downstream service:

Production safeguards

GraphQL debugging starts by deciding whether the failure happened before execution or during execution. That one distinction prevents a lot of false backend hunts.

Related: JSON Formatter, OAuth JWT Debugging, OpenAPI Contract Checklist, API Debugging Checklist.