# Conversations

> Conversations, messages, turns and steps: 13 endpoints of the Teemli API.

Source: https://docs.teemli.com/developers/reference/conversations/

Generated from [`api/openapi.yaml`](/developers/api/) (OpenAPI 3.1). Base URL: `https://api.teemli.com`. Auth: `Authorization: Bearer <token or tml_ API key>`. Errors are `application/problem+json`; writes accept an `Idempotency-Key` header.

Conversations, messages, turns and steps

## My conversations

```http
GET /v1/orgs/{org}/conversations
```

The caller's conversations, most recently active first.

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `agent_id` | query | string (uuid) |  |
| `kind` | query | ConversationKind |  |
| `state` | query | `active`, `needs_you`, `done`, `failed`, `stopped`, `all` | Task segment: active (working or waiting), needs_you (an open card for me), done, failed (couldn't finish), stopped, all |
| `limit` | query | integer | Page size. |
| `cursor` | query | string | Opaque cursor from a previous page's `next_cursor`. |

**Responses**

- `200` A page of conversations — ConversationPage
- `400` Malformed request (e.g. invalid cursor or filter) — Problem
- `401` Missing, invalid or expired token — Problem

## Open the main thread with an agent, or start a task

```http
POST /v1/orgs/{org}/conversations
```

`kind: person_agent` returns the caller's main thread with the agent (created if
missing; 200, or 202 when `text` is posted). `kind: task` creates a task conversation
(201) and requires `text`. When `text` is given, it is posted as the first message and
a turn starts (stream over `/v1/ws`).

**API keys:** needs the `agents:run` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `agent_id` (required) | string (uuid) |  |
| `kind` | `person_agent`, `task` |  |
| `title` | string |  |
| `text` | string |  |

**Responses**

- `200` Existing or new main thread (no message posted) — ConversationCreated
- `201` Task created (first message posted) — ConversationCreated
- `202` Main thread with a message posted — ConversationCreated
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem
- `422` Invalid input — Problem

## One conversation

```http
GET /v1/orgs/{org}/conversations/{conversation}
```

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `conversation` (required) | path | string (uuid) |  |

**Responses**

- `200` The conversation, with its current turn — Conversation
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Rename a conversation or task

```http
PATCH /v1/orgs/{org}/conversations/{conversation}
```

**API keys:** needs the `agents:write` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `conversation` (required) | path | string (uuid) |  |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `title` | string |  |

**Responses**

- `200` Updated — Conversation
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Messages

```http
GET /v1/orgs/{org}/conversations/{conversation}/messages
```

Person, agent and system messages. Agent messages carry `turn_id` and `meta`
(`model`, `interim: true` for text written alongside tool calls, `interrupted: true` for
partial text cut off by a new message, `greeting: true`). System messages explain
failures and setup changes (`meta.error`, `meta.card_id`).

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `conversation` (required) | path | string (uuid) |  |
| `order` | query | `desc`, `asc` | desc = newest first (load the latest page and scroll back) |
| `limit` | query | integer | Page size. |
| `cursor` | query | string | Opaque cursor from a previous page's `next_cursor`. |

**Responses**

- `200` A page of messages — MessagePage
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Send a message

```http
POST /v1/orgs/{org}/conversations/{conversation}/messages
```

Saved, then published to Kafka (`message.created`). The worker starts a turn,
interrupting one that is running (it keeps the partial text) or waiting (its open
cards become `superseded`). Returns **202**; the reply streams over `/v1/ws`.
A message starting with `/skill-name` invokes that skill. Max 32,000 characters.
**Files (G1):** upload first (`POST …/files`), then send `file_ids` (up to 10; text may be empty). Images and
PDFs are given to the model (the latest three messages with attachments); every file is also put on the
agent's computer at `~/Uploads/<name>`. The message's `files` lists them.

**API keys:** needs the `agents:run` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `conversation` (required) | path | string (uuid) |  |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `text` | string | Required (non-empty) unless file_ids are given |
| `file_ids` | array of string (uuid) |  |

**Responses**

- `202` Accepted — object
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem
- `409` Conflicting state (card already answered, duplicate in flight, name taken) — Problem
- `422` Invalid input — Problem

## Turns (newest first)

```http
GET /v1/orgs/{org}/conversations/{conversation}/turns
```

For turn footers ("Worked for 1m 12s · $0.04 · Sonnet 5.5") and status chips.

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `conversation` (required) | path | string (uuid) |  |
| `limit` | query | integer | Page size. |
| `cursor` | query | string | Opaque cursor from a previous page's `next_cursor`. |

**Responses**

- `200` A page of turns — TurnPage
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Attach a file (G1)

```http
POST /v1/orgs/{org}/conversations/{conversation}/files
```

Raw body (≤ 25 MB), `Content-Type` = the file's type. Only the person in the conversation. `kind`: `image`
(png/jpeg/gif/webp ≤ 5 MB) and `pdf` (≤ 20 MB) are read by the model; `file` goes to the computer only. Send it
with `POST …/messages {file_ids}`.

**API keys:** needs the `agents:run` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `conversation` (required) | path | string (uuid) |  |
| `name` (required) | query | string |  |

**Request body:** `application/octet-stream`.

**Responses**

- `201` Uploaded — ConversationFile
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem
- `422` Invalid input — Problem

## Download an attached file (images and PDFs inline, others as attachments)

```http
GET /v1/orgs/{org}/conversations/{conversation}/files/{file}/content
```

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `conversation` (required) | path | string (uuid) |  |
| `file` (required) | path | string (uuid) |  |

**Responses**

- `200` The bytes
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Stop the running or waiting turn

```http
POST /v1/orgs/{org}/conversations/{conversation}/stop
```

The turn ends as `stopped` (what already ran is kept); open cards become `superseded`.

**API keys:** needs the `agents:run` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `conversation` (required) | path | string (uuid) |  |

**Responses**

- `202` Accepted; the worker acts on it (watch `/v1/ws`) — object
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Retry (run a new turn over the conversation as it is)

```http
POST /v1/orgs/{org}/conversations/{conversation}/retry
```

**API keys:** needs the `agents:run` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `conversation` (required) | path | string (uuid) |  |

**Responses**

- `202` Accepted; the worker acts on it (watch `/v1/ws`) — object
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## One turn

```http
GET /v1/orgs/{org}/turns/{turn}
```

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `turn` (required) | path | string (uuid) |  |

**Responses**

- `200` The turn — Turn
- `401` Missing, invalid or expired token — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Steps of a turn (in order)

```http
GET /v1/orgs/{org}/turns/{turn}/steps
```

The step timeline ("Worked for 2m · 14 steps ›") and the work panel's Steps tab.

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `turn` (required) | path | string (uuid) |  |
| `limit` | query | integer | Page size. |
| `cursor` | query | string | Opaque cursor from a previous page's `next_cursor`. |

**Responses**

- `200` A page of steps — StepPage
- `401` Missing, invalid or expired token — Problem
