> ## Documentation Index
> Fetch the complete documentation index at: https://wisdomai-add-trigger-agent-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GraphQL API

Create seamless integrations with Wisdom AI 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.
</Note>

## Get Started

The **Wisdom API** provides real-time access to structured data insights via a WebSocket-based subscription model. Users can ask questions related to business intelligence and receive structured responses, including tabular data and SQL queries.

The Wisdom AI GraphQL API provides a single endpoint for all operations:

```
https://{ACCOUNT}.askwisdom.ai/graphql
```

## WebSocket Connection

Use the following URL to establish the WebSocket connection:

```
wss://{ACCOUNT}.askwisdom.ai/graphql
```

## Authentication

The APIs require authentication using a **JWT session token** obtained via the Descope authentication system.

The authentication flow consists of the following steps:

<Steps>
  <Step title="Obtain Access Key" titleSize="h3">
    Contact WisdomAI support at `support@askwisdom.ai` to obtain your dedicated access key.
  </Step>

  <Step title="Exchange Access Key for JWT Token" titleSize="h3">
    Use WisdomAI's GraphQL API `exchangeAccessToken` query to exchange your access key for a JWT token.

    * GraphQL Query:

      ```graphql
      query ExchangeAccessToken($accessToken: String!) {
        exchangeAccessToken(accessToken: $accessToken)
      }
      ```
  </Step>

  <Step title="Pass Token in Requests" titleSize="h3">
    The session token is required in all API requests and WebSocket connection payload.

    ```
    Authorization: Bearer YOUR_SESSION_TOKEN
    ```
  </Step>
</Steps>

## Error Handling

| Error Code | Message               | Cause                                   |
| ---------- | --------------------- | --------------------------------------- |
| `401`      | Unauthorized          | Invalid or missing authentication token |
| `400`      | Bad Request           | Malformed request payload               |
| `500`      | Internal Server Error | Unexpected API failure                  |

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

## Next Steps

<CardGroup cols={2}>
  <Card title="Exchange Access Token" icon="key" href="/integrations/graphql-api/queries/auth/exchange-access-token">
    Authenticate with the GraphQL API using access keys
  </Card>

  <Card title="Queries" icon="magnifying-glass" href="/integrations/graphql-api/queries">
    Learn about available queries for fetching data
  </Card>

  <Card title="Mutations" icon="pen-to-square" href="/integrations/graphql-api/mutations">
    Discover mutations for creating and updating resources
  </Card>

  <Card title="Subscriptions" icon="wifi" href="/integrations/graphql-api/subscriptions">
    Real-time data subscriptions and live updates
  </Card>
</CardGroup>
