# Assistant

Read summaries of the assistant's chats and runs.

Web version: https://www.svanja.com/docs/api/assistant/

The assistant is Svanja's built-in AI. It replies in [Chat](https://app.svanja.com/chat) and handles the work you give it. These endpoints let you read chats and runs for the person who owns the API key. A run is a single attempt by the assistant to answer a message or complete a piece of work.

Use these endpoints to check what was asked and how much it cost. Rather than returning the full conversation, they give you summaries with short excerpts and usage details. Your API key needs the Assistant area, which is included in both Full access and Read-only keys. For more on how the assistant works, see [Chat with the assistant](https://www.svanja.com/docs/chat-and-the-assistant/).

Both endpoints use cursor-based pagination. To list the runs for a specific chat:

```bash
curl "https://app.svanja.com/api/v1/assistant/runs?chat_id=CHAT_ID" \
  -H "Authorization: Bearer $SVANJA_API_KEY"
```

When `meta.pagination.has_more` is true, pass `meta.pagination.next_cursor` as the `cursor` parameter to get the next page. If you want to give the assistant work through the API, start a [task](https://www.svanja.com/docs/api/tasks/).

## Operations

| Operation | What it does | Effect | Endpoints |
| --- | --- | --- | --- |
| `assistant.chat.read` | Read assistant chats. | Reads only | `GET /assistant/chats`<br>`GET /assistant/chats/{chat_id}` |
| `assistant.run.read` | Read assistant runs. | Reads only | `GET /assistant/runs`<br>`GET /assistant/runs/{run_id}` |

## Endpoints

### GET /api/v1/assistant/chats

List assistant chats

Lists assistant chat summaries owned by the API key's bound visibility user. Provider runtime state, prompts, tools, events, page context, billing internals, and numeric ids are not exposed.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `per_page` | query | integer | no | Page size. Defaults to 25 and is capped at 100. |
| `cursor` | query | string | no | Signed cursor returned by the previous assistant chat page. |
| `status` | query | one of active, archived, all | no | Filter assistant chats by archive state. |
| `created_from` | query | string | no | Inclusive created_at lower bound. Must include seconds and Z or an explicit UTC offset. |
| `created_to` | query | string | no | Inclusive created_at upper bound. Must include seconds and Z or an explicit UTC offset. |

### GET /api/v1/assistant/chats/{chat_id}

Show assistant chat

Shows one assistant chat summary for the bound visibility user. Missing, malformed, cross-team, other-user, and deleted chats return the same resource_not_found envelope after capability checks.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `chat_id` | path | string | yes | Assistant chat public ULID. This is not the internal numeric chat id. |

### GET /api/v1/assistant/runs

List assistant runs

Lists assistant run summaries owned by the API key's bound visibility user. The response includes bounded text excerpts and aggregate usage facts only; raw prompts, tool payloads, events, provider ids, runtime state, page context, billing internals, and numeric ids are excluded.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `per_page` | query | integer | no | Page size. Defaults to 25 and is capped at 100. |
| `cursor` | query | string | no | Signed cursor returned by the previous assistant run page. |
| `chat_id` | query | string | no | Filter runs to one assistant chat public ULID. |
| `status` | query | one of pending, running, awaiting_confirmation, awaiting_user_input, cancelled, completed, denied, failed | no | Filter assistant runs by status. |
| `created_from` | query | string | no | Inclusive created_at lower bound. Must include seconds and Z or an explicit UTC offset. |
| `created_to` | query | string | no | Inclusive created_at upper bound. Must include seconds and Z or an explicit UTC offset. |

### GET /api/v1/assistant/runs/{run_id}

Show assistant run

Shows one assistant run summary for the bound visibility user. Missing, malformed, cross-team, other-user, and deleted runs return the same resource_not_found envelope after capability checks.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `run_id` | path | string | yes | Assistant run public ULID. This is not the internal numeric run id. |
