GraphQL Variables Builder
Build GraphQL query variables visually. Define names, types, and values — get a typed query signature and copy-ready variables JSON instantly. Works for queries, mutations, and subscriptions.
Frequently Asked Questions
What is a GraphQL variable?▼
GraphQL variables are dynamic values passed separately from the query string at runtime. Instead of hardcoding values like query GetUser { user(id: "abc") }, you write query GetUser($id: ID!) { user(id: $id) } and pass { "id": "abc" } as the variables JSON. This prevents injection attacks, enables query reuse, and makes caching more effective.
What does the '!' mean in a GraphQL type?▼
The exclamation mark (!) marks a type as non-null — it means the field is required and the server guarantees it will never be null. For example, $id: ID! means the id variable must always be provided. Without !, the variable is optional and can be omitted or set to null.
How do I pass a list of values as a GraphQL variable?▼
Use list type syntax like [String!] and check the 'List' option in this tool. In the variables JSON, provide a JSON array: { "tags": ["news", "tech"] }. The type [String!] means a nullable list of non-null strings. [String!]! would mean a required list of non-null strings.
What is the ID scalar type in GraphQL?▼
ID is a built-in scalar type used for unique identifiers. It is serialized as a string in JSON but can represent string or integer IDs. Clients should treat it as opaque — don't perform arithmetic on it. Use ID for database primary keys, UUIDs, or any field used to uniquely identify an object.
How do I use variables in a GraphQL client?▼
Most GraphQL clients (Apollo, urql, fetch) accept variables separately from the query. With fetch: fetch('/graphql', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ query: '...', variables: { id: '123' } }) }). With Apollo useQuery: useQuery(MY_QUERY, { variables: { id: '123' } }).
What is the difference between query, mutation, and subscription variables?▼
The variable syntax is the same for all three operation types. Variables are declared in the operation signature ($name: Type) and used in field arguments. The operation type (query/mutation/subscription) describes what the operation does — read, write, or real-time stream — but the variable mechanism works identically.
Related Products
on GumroadAPI Testing Cheatsheet Pack
Quick-reference cheatsheets for REST, GraphQL, and WebSocket testing. Includes Postman collections, shell scripts for smoke tests and load tests, and JWT decoder.
Buy on Gumroad →DevToolkit Starter Kit
A ready-to-deploy developer tools website with 12 built-in tools. Astro + Preact + Tailwind. Deploy to Cloudflare Pages for free. Built-in SEO, dark mode, and ad-ready layout.
Buy on Gumroad →TypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →You Might Also Need
JSON Diff Viewer
Free JSON diff viewer. Compare two JSON objects side-by-side with color-coded highlights: added lines in green, removed in red. Auto-formats JSON before comparing. Runs in your browser — your data nev
Open free tool →
JSON Diff
Free JSON diff tool. Compare two JSON objects side-by-side with color-coded highlights: added lines in green, removed in red. Auto-formats JSON before comparing. Runs in your browser — your data never
Open free tool →
GraphQL Query Builder
Build GraphQL queries visually from your schema SDL. Select root fields, pick sub-fields, add arguments, and generate query/mutation/subscription strings instantly. Supports nested types.
Open free tool →
More Free Tools
Related Articles
JSON Diff Viewer Online: Compare JSON Objects and Find Differences Instantly
Compare two JSON objects side by side and spot differences instantly. Learn how JSON diff tools work, when to use them, and how to compare JSON in JavaScript, Python, and the command line.
How to Format JSON Online: The Complete Developer Guide
Master JSON formatting online with this complete developer guide. Learn to format, validate, and debug JSON instantly using free browser tools — no install needed.
JSON vs YAML Developer Guide 2025: When to Use Each Format
JSON vs YAML: a practical developer guide covering syntax differences, use cases, performance, tooling, and conversion. Know exactly when to choose each format.
Online JSON Formatter: Instantly Beautify, Validate, and Debug JSON
Use a free online JSON formatter to beautify, validate, and debug JSON data. Learn JSON syntax rules, common errors, and how to format JSON in seconds — no install needed.
How to Format JSON Online: Complete Guide to Formatting, Validating, and Debugging JSON
Learn how to format JSON online in seconds. Complete guide covers JSON formatting, validation, debugging common errors, programmatic formatting in JavaScript/Python, and JSON Schema validation.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →