# Conversations API

> Start conversations from your own app, identify the end user, hand a chat to your team, record a rating or a resolution, and read what your agent can do.

The agent endpoints let your own app start and continue conversations with your agent, identify who is asking, and pass a chat to a person in your Inbox. Every conversation started this way appears in your dashboard Inbox like a chat from any other channel.

## Before you start

- Use an API key from [API keys](/developers/api-keys/). The key identifies the workspace.
- Calls count against the key's rate limits and use message credits when an answer is written. See [API errors and rate limits](/developers/errors-and-limits/).

## Ask and identify the user

`POST /v1/agent/ask` works like the plain question endpoint, with two additions: you can tell AskVault who the end user is, and the response carries signals your app can act on.

| Field | Required | Notes |
|---|---|---|
| `message` | Yes | The question, 1 to 8,000 characters. |
| `session_id` | No | Your key for this end user, so each person has their own thread. |
| `conversation_id` | No | A conversation id from an earlier response. |
| `user` | No | An object with `external_id`, `email`, `name` and `plan`. AskVault keeps a contact record for the person. |
| `top_k` | No | How many passages to read, 1 to 20. |

This endpoint takes the question as `message`, where `/v1/query` takes `query`.

The response holds `answer`, `sources` (document name, URL and relevance score), `confidence`, `answered`, `escalated`, `conversation_id`, `message_id` and `tokens_used`. Use `answered` and `escalated` to decide when to route the person to a human. `confidence` can be `null`.

## Hand a conversation to your team

`POST /v1/agent/escalate` with `conversation_id` (and an optional `reason` up to 500 characters) moves the conversation to your Inbox as an open handoff. It returns the conversation id, its status and `escalated: true`.

## Record a rating or a resolution

- `POST /v1/agent/csat` takes `conversation_id`, a `score` from 1 to 5 and an optional `comment`. It returns the stored score. A rating the customer already gave is not overwritten (HTTP 409).
- `POST /v1/agent/resolve` takes `conversation_id` and `resolved`. With `true`, the conversation counts as confirmed resolved by the AI. With `false`, it is handed to a person. It returns the new `resolution_state`.

An unknown conversation id, or one that belongs to another workspace, returns 404.

## See what your agent can do

`GET /v1/agent/capabilities` returns the workspace name, the enabled skills, the channels that are connected and switched on, and whether escalation and streaming are available. Your website widget, hosted page and API keys are set up separately, so they usually do not appear in `channels`. Responses can gain new fields over time, so ignore fields you do not recognise.

## All the endpoints

Every endpoint is under `https://api.askvault.co/v1` and, except the first, needs `Authorization: Bearer ak_xxx`.

| Endpoint | What it does |
|---|---|
| `GET /v1/health` | Liveness check. No key needed. |
| `POST /v1/query` | Ask a question and get a grounded answer. See [Ask a question with the API](/developers/query/). |
| `POST /v1/query/stream` | The same answer, streamed. See [Stream answers with the API](/developers/streaming/). |
| `POST /v1/agent/ask` | Ask, identify the user and get handoff signals back. |
| `POST /v1/agent/escalate` | Hand a conversation to your team. |
| `POST /v1/agent/csat` | Record a 1 to 5 rating. |
| `POST /v1/agent/resolve` | Record whether the customer says the issue is solved. |
| `GET /v1/agent/capabilities` | List enabled skills and connected channels. |

## What the API does not do

There is no endpoint to list, read, search, edit or delete conversations, and none to create or configure channels. To get history out, use the export in the Inbox. Connect and manage channels in the dashboard under [Channels](/channels/), or ask [Setup Copilot](/copilot/) to do it for you. To be told about new chats as they happen, subscribe to [webhooks](/developers/webhooks/).

## Check it worked

Call `ask` with a `session_id`, then open the Inbox: the conversation is listed there. Call `capabilities` to confirm your key and workspace.

## If it doesn't work

**404 "Conversation not found".** The id is wrong or belongs to another workspace.

**An `ak_` key is refused on a dashboard address.** It only works on `/v1` routes.

**I need to know whether a channel is healthy.** `capabilities` only says a channel is switched on. Channel health is shown on the Channels page.

## Related

- [AskVault API: get started](/developers/)
- [Webhooks](/developers/webhooks/)
- [Hand chats to a person](/actions/hand-off-to-a-person/)

Source: https://docs.askvault.co/developers/conversations/
