docs/content/graphql/guides/using-graphql-clients.md at main · github/docs · GitHub
Skip to content

Latest commit

 

History

History
79 lines (57 loc) · 3.23 KB

File metadata and controls

79 lines (57 loc) · 3.23 KB
title Using GraphQL Clients
intro You can run queries on real {% data variables.product.prodname_dotcom %} data using various GraphQL clients and libraries.
redirect_from
/v4/guides/using-the-explorer
/graphql/guides/using-the-explorer
/graphql/overview/explorer
versions
fpt ghec ghes
*
*
*
category
Get started and make API calls

Warning

The GraphQL Explorer was removed from the documentation on November 11, 2025. See our changelog announcement.

Using GraphQL client IDEs

There are many open-source GraphQL client IDEs you can use to access {% data variables.product.company_short %}'s GraphQL API.

See AUTOTITLE for extensive information on HTTP methods, authentication, and GraphQL call structure.

First, choose a client. Common options include GraphiQL, Insomnia, and Altair (desktop/web/extension). You can see the full list of clients in the GraphQL organization's tool directory.

The following generic instructions will work with most GraphQL clients:

  1. Point the client at the GraphQL endpoint: {% data variables.product.graphql_url %}.

  2. Add an Authorization header: Authorization: Bearer TOKEN (replace TOKEN with your {% data variables.product.company_short %} {% data variables.product.pat_generic %}. For more information, see AUTOTITLE).

  3. Set the request method to POST or if it's available, use the client-provided GraphQL mode.

  4. Enter your query or mutation in the editor and, if needed, provide variables in the "Variables" panel.

    Example:

    query {
      viewer {
        login
      }
    }
  5. If your client needs a schema for documentation rendering or autocomplete, fetch it via a GraphQL introspection query. Many clients can do this automatically from the "Docs" panel.

    Minimal introspection query:

    query IntrospectionQuery {
      __schema {
        types {
          name
        }
      }
    }
  6. Run the request and inspect the JSON response. Query from example should return the login associated with the {% data variables.product.company_short %} {% data variables.product.pat_generic %} you authenticated with.

Use the client UI to explore docs, run queries, and save requests as needed.

{% data variables.product.prodname_cli %}

You can also use the command line with {% data variables.product.prodname_cli %} to run GraphQL queries.

  1. Install and authenticate with {% data variables.product.prodname_cli %}.
  2. Run a query against {% data variables.product.graphql_url %} using the GraphQL endpoint with the gh api subcommand.

Example:

gh api graphql -f query='query { viewer { login } }'

This should return the login associated with the {% data variables.product.company_short %} {% data variables.product.pat_generic %} you authenticated with.

Requesting support

{% data reusables.support.help_resources %}