---
schema_version: "1"
id: 630e289669be325fabd484004394696c4fcc345ac0c0a40ab00b808e665f2917
title: Connect Altair GraphQL Client to Salesforce
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/graphql-api/graphql/guides/get-started-graphql.md
canonical_url: https://developer.salesforce.com/docs/platform/graphql/guide/get-started-graphql.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5d94cfd8a60a3a805431792a32a121e57ab8609722c6e3e2453922d8a0d0de5a
products:
  - GraphQL API
---
# Connect Altair GraphQL Client to Salesforce

[Altair GraphQL Client](https://altairgraphql.dev) is an open-source tool that helps you debug GraphQL queries and implementations. The client provides schema documentation via introspection through a rich interface.

To query the API, you need the base URL and an API access token.

**note:** Alternatives to Altair GraphQL Client include [GraphiQL](https://github.com/graphql/graphiql) and [Postman](https://developer.salesforce.com/docs/platform/graphql/guide/get-started-postman.md). Use Postman if you want to explore and test GraphQL API without access to schema documentation.

## Prerequisites

- [Salesforce Developer Edition](https://developer.salesforce.com/signup)
- Install [Altair GraphQL Client](https://altairgraphql.dev/#download) based on your operating system.
  **tip:** Turn off warning alerts in Altair GraphQL Client. Warnings don’t affect the functionality of GraphQL and can be ignored. Click the Settings icon and select **Settings**. Turn on **Disable warning alerts** and click **Save**.

Next, get an API access token so you can send a request to your Salesforce org.

## Step 1: Get an API Access Token

GraphQL API uses OAuth 2.0, similar to other Salesforce REST APIs. To get the API access token, follow [the Connect REST API Quick Start](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/quickstart.htm).

**note:** 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 [external client app](https://help.salesforce.com/s/articleView?id=xcloud.external_client_apps.htm) and an OAuth authorization flow that fits your specific use case.

After you create an external client app and set up your [OAuth authorization](https://help.salesforce.com/s/articleView?id=xcloud.remoteaccess_oauth_client_credentials_flow.htm), you can use Salesforce CLI or run this `curl` command to get an access token.

```bash
curl https://MyDomainName.my.salesforce.com/services/oauth2/token -d 'grant_type=client_credentials' -d 'client_id=consumer-key' -d 'client_secret=consumer-secret'
```

Replace this value:

- `MyDomainName`: A custom subdomain specific to a Salesforce org. For example, `companyname` creates the URL `https://companyname.my.salesforce.com`.

**note:** The `MyDomainName.lightning.force.com` URL format isn’t supported for OAuth authorization. Use `MyDomainName.my.salesforce.com` instead.

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.

## Step 2: Send a Request from Altair GraphQL Client

Now that you have your access token, you’re ready to send a GraphQL API request to Salesforce.

**note:** The instructions assume you’re using Altair GraphQL Client on MacOS; steps can vary slightly if you’re using the client on another operating system.

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}.my.salesforce.com/services/data/v{version}/graphql`, for example `https://myorg-dev-ed.my.salesforce.com/services/data/v57.0/graphql`.
3. Edit the HTTP headers.
   1. Click the Set Headers icon (![Set header icon](https://developer.salesforce.com/docs/media/altair-headers-icon.png)) 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](#step-1-get-an-api-access-token). The format is `Bearer access_token`. For example, `Bearer 00DRM000000LnTv!AREAQN.therestofyourtokenhere`.
   4. To ensure proper encoding, click **Add header**.
   5. For the **Header key** field, enter `X-Chatter-Entity-Encoding`.
   6. For the **Header value** field, enter `false`.
   7. Click **Done**.
4. Back in the main client window, enter your query. You can use your own query or this example query.

   ```
query accounts {
       uiapi {
            query {
                Account {
                    edges {
                        node {
                            Id
                             Name {
                                value
                            }
                        }
                    }
                }
            }
       }
   }
```

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](https://altairgraphql.dev/docs/).

![Work with Altair GraphQL Client](https://developer.salesforce.com/docs/media/altair-graphql-client.png)

## Step 3: Explore the GraphQL API Schema

To explore the GraphQL API schema documentation:

**note:** The instructions assume you’re using Altair GraphQL Client on MacOS; steps can vary slightly if you’re using the client on another operating system.

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](https://developer.salesforce.com/docs/media/altair-reload-docs-icon.png)).

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](https://developer.salesforce.com/docs/media/altair-docs-explorer.png)

If you receive an error about invalid schema, verify that you set the correct encoding HTML header as described in sub-steps 4–6 in [Step 2: Send a Request from Altair GraphQL Client](https://developer.salesforce.com/docs/platform/graphql/guide/get-started-graphql.md#step-2-send-a-request-from-altair-graphql-client).
