How to test a GraphQL API in API Spector
API Spector has a dedicated GraphQL editor, so you work with the schema instead of pasting a query into a raw text body. You get autocomplete, a point-and-click Explorer, a variables panel, and live validation, all driven by the real schema of the endpoint you are calling.
1. Create the request
Add a request, set the method to POST, and put your GraphQL endpoint in the URL. GraphQL is served over a single endpoint, so every query and mutation goes to the same URL. This walkthrough uses the public https://countries.trevorblades.com/ API.
2. Switch the body to GraphQL
Open the Body tab and choose the graphql mode. The editor splits into three parts: the query area (with syntax highlighting and a ✓ valid or error badge), a Variables panel at the bottom, and the schema Explorer.
3. Fetch the schema
Click Fetch schema. API Spector runs an introspection query against the endpoint and caches the result with the request. From that point the editor knows every type, field, and argument, so you get autocomplete as you type, inline validation of the query, and a populated Explorer.
4. Build a query in the Explorer
The Explorer is the fastest way to write a correct query without digging through docs. It lists the root operations grouped under QUERY, MUTATION, and SUBSCRIPTION, with each field's return type shown beside it.

- Use the Search fields box to jump to a field by name.
- Tick Hide fields that require arguments to focus on the list and collection fields you can call without inputs (it hides the by-id lookups such as
country(code!)). - Click a field to insert it into the query in the right place, then drill into its sub-fields the same way. The editor keeps the query valid as you build it.
Use the Explorer button to hide the panel when you want the full width for the editor.
5. Add variables and send
Parameterise the query with $variables and set their values as JSON in the Variables panel, then press Send. The result comes back in the normal response viewer, so you can read it in the Tree, Raw, or Table view and click into the data.

Beyond a single query
- Assertions: the Scripts tab lets you assert on the result with
sp.test(...), the same as any other request, so a GraphQL call becomes a real test. - Chaining: capture a value from the response into a variable with a post-response script, then reference it with
{{variable}}in the next request's query or variables. - Introspection in scripts: the Scripts tab has a GQL Introspect section for pulling the schema programmatically.
Because GraphQL rides on HTTP, everything else in API Spector still applies: auth, custom headers, environments, code generation, and running the request from the CLI or in CI.