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

# Using the GraphQL API

> Learn useful terminology and concepts for using the GraphQL API

<Tip>
  If you are new to GraphQL, we recommend reading the [Official GraphQL documentation](https://graphql.org/learn/). This page has information on how to use the Codex GraphQL API specifically. Check out our [Popular Endpoints](/api-reference/popular-endpoints) for the most commonly used queries and subscriptions.
</Tip>

## Adding to your app

Use the GraphQL API directly by adding the `Authorization` header to your requests ([read about Authentication](/concepts/authentication)). and sending requests to:

```
graph.codex.io/graphql
```

## Explorer

The [GraphQL Explorer](/explore) is a great way to learn about the Codex GraphQL API.
It's a tool that allows you to explore the API, run queries, and subscriptions, complete with with tabs, persistence, and history.

## URLs

Codex provides a url for both queries & subscriptions (websockets) at the same resource.

Queries:

```
https://graph.codex.io/graphql
```

Websockets:

```
wss://graph.codex.io/graphql
```

## Introspection

Codex does not support introspection queries against the API.

We do provide the introspection query response, as well as the most recent schema.

<CardGroup cols={2}>
  <Card title="JSON" href="https://graph.codex.io/schema/latest.json">
    The introspection query response. (.json)
  </Card>

  <Card title="Schema" href="https://graph.codex.io/schema/latest.graphql">
    The GraphQL schema. (.graphql)
  </Card>
</CardGroup>

## Communication

All queries and mutations are sent over HTTPS, using the `POST` method.

All websocket messages are sent over the `wss` protocol.

All messages are serialized as JSON.

## Codegen

We recommend using [GraphQL Code Generator](https://www.graphql-code-generator.com/) to generate types and queries for your codebase, using the introspection schema provided [ here ](#introspection).

Below is an example of how you could integrate the code generator into your project.

```typescript codegen.ts expandable theme={null}
import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
  overwrite: true,
  schema: "https://graph.codex.io/schema/latest.graphql",
  documents: "src/**/*.ts",
  generates: {
    "src/gql/": {
      preset: "client",
    },
  },
};

export default config;
```
