GraphQL APIs have a single endpoint, and you describe exactly which fields you want in a query. Hoppscotch has a dedicated GraphQL screen that fetches the API’s schema, shows its documentation and helps you write queries. This guide uses a free public API about countries, so you can follow along without an account.

1. Open the GraphQL screen

Switch from REST to GraphQL using the sidebar. You’ll see an endpoint field, a query editor, tabs for variables and headers, and a response area.

2. Connect to an endpoint

Enter https://countries.trevorblades.com/ in the endpoint field and connect. Hoppscotch asks the server for its schema (a process called introspection). When it succeeds, the schema and documentation panels fill with the types the API offers.

3. Explore the docs

Open the documentation panel and click through the types. You’ll find a country query that takes a code argument and returns fields such as name, capital and currency. The multi-column view lets you drill into nested types without losing your place.

4. Write and run a query

query {
  country(code: "PK") {
    name
    capital
    currency
    languages {
      name
    }
  }
}

Run it. The response contains only the fields you asked for — no more, no less. That’s the main idea of GraphQL.

5. Use variables

Hard-coding values in queries gets messy. Rewrite the query with a variable:

query CountryInfo($code: ID!) {
  country(code: $code) {
    name
    emoji
    continent { name }
  }
}

Then add this in the Variables tab:

{ "code": "JP" }

Change the variable to try other countries without touching the query.

6. Add headers for private APIs

Most production GraphQL APIs need authentication. Add a header such as Authorization: Bearer <<token>> in the Headers tab, or use the Authorization options. Environment variables work here exactly as on the REST screen — see environment variables.

7. Mutations

Mutations change data. They look like queries but start with mutation:

mutation AddTodo($text: String!) {
  addTodo(text: $text) {
    id
    text
  }
}

The public countries API is read-only, so try mutations against your own API or a sandbox environment.

Troubleshooting

  • Schema doesn’t load — some servers disable introspection in production. You can still send queries; you just won’t get documentation. Ask the API team for a schema file or a staging endpoint.
  • Errors with a 200 status — GraphQL often returns HTTP 200 even when a query fails, with details in an errors array in the body. Always read the body.
  • CORS error in the web app — see fixing CORS errors or use the desktop app.