How to use GraphQL
- 1. Paste a query or mutation. Drop a .graphql file if you prefer.
- 2. Read the printed document. Invalid syntax shows next to the input.
- 3. Copy the fetch snippet. POSTs application/json with a query field.
- 4. Run it yourself. This tab does not hit a GraphQL endpoint.
About this tool
GraphQL documents are easier to review when they are printed with a consistent AST. This tool uses graphql-js parse/print in the browser and emits a fetch snippet so you can paste the same query into an API client.
Formatter, not executor
There is no schema, no mock resolve, and no network. Invalid documents fail at parse.
Fetch body
The snippet sends { query }. Add variables and a token in your own client.
Code examples
Query
query { user(id: "1") { name } }