# Chat

> Chat module (M8a, product.md 7.15; Slack parity for everyday use): 61 endpoints of the Teemli API.

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

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.

Chat module (M8a, product.md 7.15; Slack parity for everyday use). Every `/chat/*` route returns 404 while
the organisation's `chat` switch is off (`PUT /admin/settings {switches: {chat: true}}`; data is kept).
Permissions live in Postgres (RLS): public channels are readable and joinable by everyone but guests;
private channels, DMs and group DMs only by their members (org admins included: no access to private
spaces they aren't in). AI employees read only channels they were added to; a person's own agent reads
what its person can and posts as them ("via Scout (AI)", always after an OK). Guests see only their
channels and the people in them; single-channel guests stay in one. Your read position, notification
settings, drafts, saved items, reminders and scheduled messages are private (no read receipts).
Live updates fan out per channel (`chat.*` events on `/v1/ws`, see asyncapi.yaml); messages that need work
(notifications, push, AI employees, phrase routines, link previews) become `chat.message.created` events.
**Message text** is Markdown; mentions are tokens `@[Name](person:ID)`, `@[Riya](agent:ID)`,
`@[design](team:ID)` (user groups = teams, by `handle`) and the words `@channel` / `@here`.
**ChatMessage**: `{id, channel_id, seq, thread_root_id, also_in_channel, kind: message|system,
author: {kind: person|agent|imported, id?, name?}, via_agent: {id, name}|null, text, meta,
mentions: {people, agents, teams, special}, unfurls: [{url, title, description, image, site}],
reply_count, last_reply_at, reply_person_ids, edited_at, deleted, pinned_at, pinned_by, client_id,
created_at, reactions: [{emoji, count, people, agents}], files: [{id, name, size, content_type, width, height}],
saved}` (`saved` is the viewer's own and is absent from live events).

## The sidebar in one call: channels and DMs you're in (unread, mentions, notify, muted, starred, hidden), counts (activity, later, scheduled, threads), drafts, your settings. Joins you to #general (created on first use; not guests)

```http
GET /v1/orgs/{org}/chat/bootstrap
```

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

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

**Responses**

- `200` {channels: [{id, kind, name, topic, is_general, archived, last_seq, last_message_at, last_read_seq, unread, mentions, notify, muted, starred, hidden, role, people?, agents?}], general_id, counts, drafts, prefs, me: {person_id, is_guest, guest_single}, switches} — object
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## People you can see (with status, away, notifications paused), AI employees in your channels or shared with you (`shared` = you can DM/mention them), user groups (teams with a `handle`), and your own agents

```http
GET /v1/orgs/{org}/chat/directory
```

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

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

**Responses**

- `200` {people, agents, groups: [{id, name, handle, member_ids}], my_agents}

## Who's online (a socket pinged in the last 75 s and not set to away), away, paused (dnd_until), custom status. Poll for the people on screen

```http
GET /v1/orgs/{org}/chat/presence
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `ids` (required) | query | string | Comma-separated person ids (≤ 500) |

**Responses**

- `200` {people: {<id>: {online, active, away, dnd_until, status_emoji, status_text}}}

## Browse channels (public ones, and private ones you're in)

```http
GET /v1/orgs/{org}/chat/channels
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `q` | query | string |  |
| `filter` | query | `all`, `joined`, `not_joined`, `archived` |  |
| `limit` | query | integer |  |

**Responses**

- `200` {items: [{id, kind, name, topic, description, is_general, archived, member_count, joined, last_message_at}]}

## Create a channel (people only, not guests): the name is normalised Slack-style ("Design Team" → design-team); you become its manager

```http
POST /v1/orgs/{org}/chat/channels
```

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

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

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `name` (required) | string |  |
| `kind` | `public`, `private` |  |
| `topic` | string |  |
| `description` | string |  |
| `person_ids` | array of string (uuid) |  |
| `agent_ids` | array of string (uuid) |  |

**Responses**

- `201` ChatChannel
- `409` Conflicting state (card already answered, duplicate in flight, name taken) — Problem
- `422` Invalid input — Problem

## A channel: details, member_count, people, agents, admins, has_guests, pinned_count, file_count, bookmarks, and `me` (member, can_manage, last_read_seq, notify, muted, starred)

```http
GET /v1/orgs/{org}/chat/channels/{id}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` ChatChannel
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Rename, set the topic or description, archive / unarchive (members; org admins for public channels). Leaves a system message

```http
PATCH /v1/orgs/{org}/chat/channels/{id}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `name` | string |  |
| `topic` | string |  |
| `description` | string |  |
| `archived` | boolean |  |

**Responses**

- `200` ChatChannel

## Join a public channel

```http
POST /v1/orgs/{org}/chat/channels/{id}/join
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` ChatChannel
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem

## Leave a channel (not #general; DMs are closed with `PATCH …/me {hidden: true}`)

```http
POST /v1/orgs/{org}/chat/channels/{id}/leave
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {left}

## Your own settings for this conversation: notify (default | all | mentions | none), muted, starred, hidden (close a DM until its next message)

```http
PATCH /v1/orgs/{org}/chat/channels/{id}/me
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `notify` | string |  |
| `muted` | boolean |  |
| `starred` | boolean |  |
| `hidden` | boolean |  |

**Responses**

- `200` ChatChannel

## Mark read up to `seq` (never goes back; all when absent), or `unread_from` a message

```http
POST /v1/orgs/{org}/chat/channels/{id}/read
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `seq` | integer |  |
| `unread_from` | string (uuid) |  |

**Responses**

- `200` {last_read_seq}

## Members (people, guests, AI employees) with role and guest flags

```http
GET /v1/orgs/{org}/chat/channels/{id}/members
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {items: [{id, person_id, agent_id, role, joined_at, is_guest, guest_single, invited}]}

## Add colleagues and AI employees shared with you (members, not guests); invite a guest by email (guests switch on; single-channel or multi-channel; they get an email)

```http
POST /v1/orgs/{org}/chat/channels/{id}/members
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `person_ids` | array of string (uuid) |  |
| `agent_ids` | array of string (uuid) |  |
| `guest_email` | string |  |
| `guest_single` | boolean |  |

**Responses**

- `200` {items: ChatMember[]}
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem

## Make someone a channel manager or member (managers only)

```http
PATCH /v1/orgs/{org}/chat/channels/{id}/members/{member}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |
| `member` (required) | path | string (uuid) |  |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `role` (required) | `member`, `admin` |  |

**Responses**

- `200` {items}

## Remove someone (managers), an AI employee you can see, or yourself (= leave)

```http
DELETE /v1/orgs/{org}/chat/channels/{id}/members/{member}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |
| `member` (required) | path | string (uuid) |  |

**Responses**

- `200` {items}

## Add a link to the channel's bookmarks bar (members)

```http
POST /v1/orgs/{org}/chat/channels/{id}/bookmarks
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `url` (required) | string |  |
| `title` | string |  |
| `emoji` | string |  |

**Responses**

- `201` ChatChannel

## Remove a bookmark

```http
DELETE /v1/orgs/{org}/chat/channels/{id}/bookmarks/{bookmark}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |
| `bookmark` (required) | path | string (uuid) |  |

**Responses**

- `200` ChatChannel

## A page of the channel (top-level messages and replies also sent to the channel), oldest first. Public channels are readable before joining

```http
GET /v1/orgs/{org}/chat/channels/{id}/messages
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |
| `before` | query | integer | Older than this seq |
| `after` | query | integer | Newer than this seq |
| `around` | query | string (uuid) | Centre on this message (a reply centres on its thread) |
| `limit` | query | integer |  |

**Responses**

- `200` {items: ChatMessage[], has_more_before, has_more_after}

## Post (members; not archived). Mentions are parsed from the text; `file_ids` are files you uploaded to this conversation; a reply goes to `thread_root_id` (the thread's first message) and can also be sent to the channel. Saves `chat.message.created` (notifications, AI employees, routines, link previews)

```http
POST /v1/orgs/{org}/chat/channels/{id}/messages
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `text` | string |  |
| `thread_root_id` | string (uuid) |  |
| `also_in_channel` | boolean |  |
| `file_ids` | array of string (uuid) |  |
| `client_id` | string |  |

**Responses**

- `201` ChatMessage
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `422` Invalid input — Problem

## Pinned messages

```http
GET /v1/orgs/{org}/chat/channels/{id}/pins
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {items: ChatMessage[]}

## The channel's notes tab (G2): `mode` notes (Docs off: Markdown) or canvas (Docs on: `canvas_page_id`, a Docs page whose access follows the channel). Readers of the channel read it; members edit

```http
GET /v1/orgs/{org}/chat/channels/{id}/notes
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {channel_id, mode: notes\|canvas, markdown, version, updated_at, updated_by, canvas_page_id, can_edit}
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Save the notes (members). `version` is the one you started from: someone else's save in between → 409, nothing is overwritten

```http
PUT /v1/orgs/{org}/chat/channels/{id}/notes
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `markdown` (required) | string |  |
| `version` (required) | integer |  |

**Responses**

- `200` Notes as in GET
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `409` Someone saved in between

## Open (create the first time) the channel's canvas: a Docs page in a hidden space, members edit, readers of a public channel view, nobody else (org admins included). Seeded with the notes. 409 while Docs is off

```http
POST /v1/orgs/{org}/chat/channels/{id}/canvas
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {page_id, created}
- `409` The Docs module is off

## How long this conversation keeps messages

```http
GET /v1/orgs/{org}/chat/channels/{id}/retention
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {days\|null, source: channel\|organisation\|forever, own_days, can_set}

## A channel manager sets its own retention (only when the organisation allows it); `days` null = the organisation's setting. A system line says so

```http
PUT /v1/orgs/{org}/chat/channels/{id}/retention
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `days` | integer \\| null |  |

**Responses**

- `200` Retention as in GET
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem

## Organisation chat settings: who adds custom emoji, message retention (channels, DMs, channel overrides)

```http
GET /v1/orgs/{org}/chat/settings
```

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

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

**Responses**

- `200` {emoji: everyone\|admins, retention_days, dm_retention_days, channel_retention, can_manage}

## Admins only. Retention is enforced by the worker every two minutes: older messages and their files are deleted for good; a thread root with newer replies stays as a placeholder

```http
PUT /v1/orgs/{org}/chat/settings
```

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

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

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `emoji` | `everyone`, `admins` |  |
| `retention_days` | integer \\| null |  |
| `dm_retention_days` | integer \\| null |  |
| `channel_retention` | boolean |  |

**Responses**

- `200` Settings as in GET
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem

## The organisation's custom emoji (used as `:name:` in messages and reactions)

```http
GET /v1/orgs/{org}/chat/emoji
```

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

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

**Responses**

- `200` {items: [{id, name, content_type, created_at, created_by, can_delete}], can_add}

## Add a custom emoji: the image as the raw body (PNG, GIF, JPEG or WebP by its bytes, ≤ 256 KB; never SVG). Members add unless an admin limited it to admins

```http
POST /v1/orgs/{org}/chat/emoji
```

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

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

**Request body:** `image/png`, `image/gif`, `image/jpeg`, `image/webp`.

**Responses**

- `201` {id, name, content_type}
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `409` The name is taken
- `422` Invalid input — Problem

## Remove an emoji (whoever added it, or an admin)

```http
DELETE /v1/orgs/{org}/chat/emoji/{id}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {deleted}
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem

## The emoji image

```http
GET /v1/orgs/{org}/chat/emoji/{id}/image
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` The image

## Open (or find) the DM / group DM (≤ 9 people) with these people, or the DM with one AI employee shared with you. Guests reach only people in their channels

```http
POST /v1/orgs/{org}/chat/dms
```

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

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

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `person_ids` | array of string (uuid) |  |
| `agent_id` | string (uuid) |  |

**Responses**

- `200` ChatChannel
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem

## A message

```http
GET /v1/orgs/{org}/chat/messages/{id}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` ChatMessage

## Edit your own message (mentions re-parsed, previews refreshed)

```http
PATCH /v1/orgs/{org}/chat/messages/{id}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `text` (required) | string |  |

**Responses**

- `200` ChatMessage
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem

## Delete your own message ("This message was deleted"; its files are removed)

```http
DELETE /v1/orgs/{org}/chat/messages/{id}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {deleted}

## The thread: its first message and every reply, and whether you follow it

```http
GET /v1/orgs/{org}/chat/messages/{id}/thread
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {root: ChatMessage, replies: ChatMessage[], following, last_read_seq}

## Add / remove your reaction (`on` absent = toggle); the author gets an inbox entry

```http
POST /v1/orgs/{org}/chat/messages/{id}/reactions
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `emoji` (required) | string |  |
| `on` | boolean |  |

**Responses**

- `200` ChatMessage

## Pin / unpin (members)

```http
PUT /v1/orgs/{org}/chat/messages/{id}/pin
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `pinned` (required) | boolean |  |

**Responses**

- `200` ChatMessage

## Threads you follow (started, replied, mentioned), newest activity first, with unread replies and the last three

```http
GET /v1/orgs/{org}/chat/threads
```

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

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

**Responses**

- `200` {items: [{root: ChatMessage, channel, unread, last_read_seq, replies}]}

## Mark a thread read up to `seq` (all when absent) and/or follow / unfollow it

```http
POST /v1/orgs/{org}/chat/threads/{id}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `seq` | integer |  |
| `following` | boolean |  |

**Responses**

- `200` {ok}

## Search messages, files and channels you can read (Postgres full-text + trigram, filtered by RLS)

```http
GET /v1/orgs/{org}/chat/search
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `q` | query | string | Words (prefix on the last) plus from:@name in:#channel before:/after:/on:YYYY-MM-DD has:file\|link\|pin is:thread |
| `from` | query | string (uuid) |  |
| `in` | query | string (uuid) |  |
| `after` | query | string (date) |  |
| `before` | query | string (date) |  |
| `has` | query | `file`, `link`, `pin` |  |
| `kind` | query | `messages`, `files`, `channels`, `all` |  |
| `limit` | query | integer |  |

**Responses**

- `200` {messages: (ChatMessage & {channel})[], files, channels, terms}

## Files shared in conversations you can read (newest first)

```http
GET /v1/orgs/{org}/chat/files
```

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

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

**Responses**

- `200` {items: [{id, channel_id, message_id, name, size, content_type, width, height, created_at, uploaded_by, channel_name}]}

## Upload a file into a conversation you're in (raw body ≤ 50 MB; image width/height from the client). Attach it by posting a message with its id

```http
POST /v1/orgs/{org}/chat/files
```

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

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

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

**Responses**

- `201` ChatFile

## Download (images, PDFs, audio and video inline; private cache 1 day)

```http
GET /v1/orgs/{org}/chat/files/{id}/content
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` The file
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Later: saved messages and reminders (state open | done)

```http
GET /v1/orgs/{org}/chat/later
```

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

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

**Responses**

- `200` {items: [{id, message_id, message, text, remind_at, fired_at, state}]}

## Save a message, "remind me about this" (message_id + remind_at), or a free-text reminder (text + remind_at)

```http
POST /v1/orgs/{org}/chat/later
```

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

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

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `message_id` | string (uuid) |  |
| `text` | string |  |
| `remind_at` | string (date-time) |  |

**Responses**

- `201` ChatLater

## Mark done / open, change or clear the reminder time

```http
PATCH /v1/orgs/{org}/chat/later/{id}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `state` | string |  |
| `remind_at` | string \\| null (date-time) |  |
| `text` | string |  |

**Responses**

- `200` ChatLater

## Remove from Later

```http
DELETE /v1/orgs/{org}/chat/later/{id}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {deleted}

## Your scheduled messages (and ones sent or failed in the last day)

```http
GET /v1/orgs/{org}/chat/scheduled
```

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

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

**Responses**

- `200` {items: [{id, channel, thread_root_id, text, send_at, state, error}]}

## Schedule a message (≥ 1 minute, ≤ 120 days ahead); sent as you by the worker, re-checked then (left / archived → failed)

```http
POST /v1/orgs/{org}/chat/scheduled
```

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

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

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `channel_id` (required) | string (uuid) |  |
| `text` (required) | string |  |
| `thread_root_id` | string (uuid) |  |
| `also_in_channel` | boolean |  |
| `file_ids` | array of string (uuid) |  |
| `send_at` (required) | string (date-time) |  |

**Responses**

- `201` ChatScheduled

## Edit text / time, or cancel (`state: cancelled`)

```http
PATCH /v1/orgs/{org}/chat/scheduled/{id}
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `text` | string |  |
| `send_at` | string (date-time) |  |
| `state` | `cancelled` |  |

**Responses**

- `200` ChatScheduled

## Send a scheduled message now

```http
POST /v1/orgs/{org}/chat/scheduled/{id}/send
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` ChatMessage

## Save the draft for a conversation or thread (empty text deletes it); the bootstrap returns them

```http
PUT /v1/orgs/{org}/chat/drafts
```

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

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

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `channel_id` (required) | string (uuid) |  |
| `thread_root_id` | string (uuid) |  |
| `text` (required) | string |  |

**Responses**

- `200` {ok}

## Your notification settings and status

```http
GET /v1/orgs/{org}/chat/prefs
```

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

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

**Responses**

- `200` ChatPrefs

## Default notifications (all | mentions | none), keywords, do-not-disturb schedule (start/end HH:MM in your time zone, ISO days), thread replies

```http
PUT /v1/orgs/{org}/chat/prefs
```

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

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

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `notify_default` | string |  |
| `keywords` | array of string |  |
| `dnd_enabled` | boolean |  |
| `dnd_start` | string |  |
| `dnd_end` | string |  |
| `dnd_days` | array of integer |  |
| `thread_replies` | boolean |  |

**Responses**

- `200` ChatPrefs

## Custom status (with `set_status: true`: emoji, text, expires_at), away, and pause notifications until (`dnd_until`, null resumes)

```http
PUT /v1/orgs/{org}/chat/status
```

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

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

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `set_status` | boolean |  |
| `emoji` | string |  |
| `text` | string |  |
| `expires_at` | string (date-time) |  |
| `away` | boolean |  |
| `dnd_until` | string \\| null (date-time) |  |

**Responses**

- `200` ChatPrefs

## Your activity inbox: mentions, DMs, thread replies, reactions, keywords, reminders

```http
GET /v1/orgs/{org}/chat/activity
```

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

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `filter` | query | `all`, `mentions`, `threads`, `reactions`, `unread` |  |

**Responses**

- `200` {items: [{id, kind, text, read, created_at, actor, channel, message}]}

## Mark activity read (these ids, a channel's, or all) or unread

```http
POST /v1/orgs/{org}/chat/activity/read
```

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

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

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `ids` | array of string (uuid) |  |
| `channel_id` | string (uuid) |  |
| `read` | boolean |  |

**Responses**

- `200` {updated}

## Dry run of a Slack workspace export (the .zip, raw body ≤ 200 MB; admins): people matched by email, channels (renamed on clashes; Slack #general goes into an empty #general), messages, threads, reactions, files included vs linked, DMs you were in vs skipped

```http
POST /v1/orgs/{org}/chat/import/slack/preview
```

**API keys:** not available (needs a person signed in to the app).

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

**Request body:** `application/zip`.

**Responses**

- `200` {people: {total, matched, matched_names, unmatched}, channels: [...], dms: {total, yours, skipped}, totals, you_matched}
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `422` Invalid input — Problem

## Import (same zip) in the background; idempotent (re-running adds nothing). Poll /chat/imports/{id}

```http
POST /v1/orgs/{org}/chat/import/slack
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `only` | query | string | Comma-separated Slack conversation ids (default: everything importable) |

**Request body:** `application/zip`.

**Responses**

- `202` {id, state}

## An import's progress

```http
GET /v1/orgs/{org}/chat/imports/{id}
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) | A Tasks object (project, section, field, item, comment, rule, form, view, attachment, notification or import). |

**Responses**

- `200` {id, state: running\|done\|failed, counts, channel_ids, error}
