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

# GraphQL API

Create seamless integrations with WisdomAI using our comprehensive GraphQL API. Access domains, tables, and analytics data programmatically to build custom applications and workflows.

> [!NOTE]
>
> The GraphQL API is designed for external integrations. All operations require proper authentication and respect your organization's access controls.

## Get started

The WisdomAI GraphQL API provides a single endpoint for all operations:

```text theme={null}
https://{ACCOUNT}.askwisdom.ai/graphql
```

> [!NOTE]
>
> Replace `{ACCOUNT}.askwisdom.ai` with the base URL of your WisdomAI tenant, the same domain you use to log in. Both `askwisdom.ai` and `wisdom.ai` are valid depending on your deployment.

The API supports queries, mutations, and real-time subscriptions. Subscriptions use a WebSocket-based model that lets users ask questions related to business intelligence and receive structured responses, including tabular data and SQL queries.

## WebSocket connection

For real-time subscriptions, use the following WebSocket endpoint:

```text theme={null}
wss://{ACCOUNT}.askwisdom.ai/graphql
```

## Authentication

WisdomAI supports two authentication flows depending on your use case:

### API authentication

For direct API access, authenticate using a JWT session token obtained via the Descope authentication system.

#### 1. Obtain access key

Every WisdomAI user can create and manage their own API keys. To obtain your dedicated access key, follow the steps in [this article](https://docs.wisdom.ai/settings/api-keys.md).

#### 2. Exchange access key for JWT token

Use WisdomAI's GraphQL API `exchangeAccessToken` query to exchange your access key for a JWT token.

```graphql theme={null}
query ExchangeAccessToken($accessToken: String!) {
  exchangeAccessToken(accessToken: $accessToken)
}
```

#### 3. Pass token in requests

Include the session token in all API requests and WebSocket connection payloads.

```text theme={null}
Authorization: Bearer YOUR_SESSION_TOKEN
```

### Embedded user authentication

For embedding scenarios, the flow is different. Instead of `exchangeAccessToken`, you call `impersonateUser` with your Descope access key to obtain a short-lived JWT for the embedded user. That JWT is passed as the `token` query parameter in the iframe URL, not in an `Authorization` header.

See the [Embedding overview](https://docs.wisdom.ai/integrations/embeddings/embedding.md) for the full end-to-end flow.

## Error handling

> [!WARNING]
>
> The WisdomAI GraphQL API returns **HTTP 200 even when an operation fails**. Always inspect the response body, not the HTTP status code. See [Error handling](https://docs.wisdom.ai/integrations/embeddings/error-handling.md) for the full reference including response shapes and status codes.

> [!NOTE]
>
> For any queries or support, contact our API team at [**support@askwisdom.ai**](mailto:support@askwisdom.ai).

## Related articles

> [card] [GraphQL primer](https://docs.wisdom.ai/integrations/graphql-api/graphql-primer.md)
>
> New to GraphQL? Start here for a REST developer's introduction

> [card] [Exchange Access Token](https://docs.wisdom.ai/integrations/graphql-api/queries/auth/exchange-access-token.md)
>
> Authenticate with the GraphQL API using access keys

> [card] [Queries](https://docs.wisdom.ai/integrations/graphql-api/queries/user/current-user.md)
>
> Learn about available queries for fetching data

> [card] [Mutations](https://docs.wisdom.ai/integrations/graphql-api/mutations/chat/create-conversation.md)
>
> Discover mutations for creating and updating resources

> [card] [Subscriptions](https://docs.wisdom.ai/integrations/graphql-api/subscriptions/subscribe-conversation.md)
>
> Real-time data subscriptions and live updates

> [card] [Error handling](https://docs.wisdom.ai/integrations/embeddings/error-handling.md)
>
> How to handle HTTP 200 failures and mutation status codes


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.