> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salesbricks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

Welcome to the Salesbricks GraphQL API – the gateway to seamless access and management of your subscriptions and orders.

Our API offers a robust, introspectable schema, empowering you to effortlessly explore and interact with its extensive capabilities.

<Tip>
  Before you begin, ensure you have read the [Authentication](/api-reference/getting-started/authentication) guide to find your `X-SALESBRICKS-KEY` and the correct **endpoint** for your use case.
</Tip>

## Setting up an Apollo Client

In this guide, we leverage Apollo Client, extending the example from their documentation [here](https://www.apollographql.com/docs/react/networking/authentication/).

```javascript JavaScript theme={null}
import { ApolloClient, createHttpLink, InMemoryCache } from '@apollo/client';
import { setContext } from '@apollo/client/link/context';

// discovered using the Authentication guide
const SALESBRICKS_API_ENDPOINT = 'https://api.salesbricks.com/api/v1/graphql';
const SALESBRICKS_API_TOKEN = '00000000-0000-0000-0000-000000000000';

const httpLink = createHttpLink({
  uri: SALESBRICKS_API_ENDPOINT,
});

const authLink = setContext((_, { headers }) => {
  return {
    headers: {
      ...headers,
      'X-SALESBRICKS-KEY': SALESBRICKS_API_TOKEN
    }
  }
});

const client = new ApolloClient({
  link: authLink.concat(httpLink),
  cache: new InMemoryCache()
});
```

## Query the schema

Once your client is configured, make queries following the defined schema.

Below is an example query to retrieve all orders:

### Example Query

```javascript JavaScript theme={null}
client
  .query({
    query: gql`
      query {
        companyOrders {
          orders {
            id
            buyer {
              id
              name
            }
          }
        }
      }
    `,
  })
  .then((result) => console.log(result));
```

### Example Response

```json JSON theme={null}
{
  "data": {
    "companyOrders": {
      "orders": [
        {
          "id": "00000000-0000-0000-0000-000000000000",
          "buyer": {
            "id": "00000000-0000-0000-0000-000000000000",
            "name": "Buyer Name"
          },
        }
      ]
    }
  }
}
```

Explore the powerful features of Salesbricks through this concise GraphQL API.

Let's dive in! 🚀
