Connect Altair GraphQL Client to Salesforce

Altair GraphQL Client is an open-source tool that helps you debug GraphQL queries and implementations. The client enables you to access schema documentation via introspection through a rich interface.

To query the API, you need the base URL and an API access token.

Alternatives to the Altair GraphQL Client include GraphiQL and Postman. Use Postman if you want to explore and test GraphQL API without access to schema documentation.

Next, get an API access token so you can send a request to your Salesforce org.

GraphQL API uses OAuth 2.0, similar to other Salesforce REST APIs. To get the API access token, follow the REST API Quick Start.

To successfully send requests, GraphQL API requires an access token obtained by authentication. This Quick Start authenticates via Salesforce CLI. For production apps, we recommend that you use your own connected app and an OAuth authorization flow that fits your specific use case.

After you create a connected app and set up your OAuth authorization, run this curl command.

Replace this value:

  • MyDomainName: A custom subdomain specific to a Salesforce org. For example, companyname creates the URL

The curl command returns your API access token in the access_token property. You need this access token to send a request via the GraphQL client.

Now that you have your access token, you're ready to send a GraphQL API request to Salesforce.

The instructions assume you are using Altair GraphQL Client on MacOS; steps might vary slightly if you're using the client on another OS.

To send a request:

  1. Open the GraphQL client you installed.
  2. Next to the POST option, enter your endpoint using the format https://{MyDomainName}{version}/graphql, for example
  3. Edit the HTTP headers.
    1. Click the Set Headers icon (Set header icon) on the sidebar. The Headers prompt appears.
    2. For the Header key field, enter Authorization.
    3. For the Header value field, enter the access token you generated in step 1. The format is Bearer access_token. For example, Bearer 00DRM000000LnTv!AREAQN.therestofyourtokenhere.
    4. Click Save.
  4. Back in the main client window, enter your query. You can use your own query or this example query.
  5. Click Send Request or the ▶️ icon to run the GraphQL query. Alternatively, you can press Ctrl + Enter (Windows) or Cmd + Enter (Mac).

Altair GraphQL Client includes an editor for your query on the left, and the result window on the right. For more information, see the Altair GraphQL Client documentation.

Work with Altair GraphQL Client

To explore the GraphQL API schema documentation:

The instructions assume you are using Altair GraphQL Client on MacOS; steps might vary slightly if you're using the client on another OS.

  1. Click Docs. A panel opens to reveal the documentation explorer.
  2. If the explorer doesn't display the types, click the Reload Docs icon (Reload docs icon).

When you load the schema, the panel displays the types and queries available in the Salesforce GraphQL API.

Review the types and queries in the Salesforce GraphQL schema