# Threads

> Starting threads from a message or on their own, renaming, locking and deleting them, following them, and listing the active and archived ones. What each route checks, and the errors.

## Before you read

Klang has **public threads** in text and voice channels: no private threads, no forums and no
announcement threads. They arrive as [type `11`](https://docs.klang.gg/bots/reference/objects/#thread). A thread has
no permissions of its own: it takes its channel’s.

- **“Archived” means inactive.** A thread with no messages for 7 days is `archived`, and writing
  in it brings it back. Nobody archives a thread by hand.
- **Joining a thread is following it**, as in the app: its new messages count as unread for you.
  Who starts a thread follows it.
- **The events**: `THREAD_CREATE`, `THREAD_UPDATE` and `THREAD_DELETE` to the bots that can see
  the channel, and [`THREAD_MEMBERS_UPDATE`](https://docs.klang.gg/bots/reference/gateway-events/#thread_members_update)
  when someone follows a thread or stops, the bot included. A channel the bot comes to see brings
  its active threads in [`THREAD_LIST_SYNC`](https://docs.klang.gg/bots/reference/gateway-events/#thread_list_sync).

A channel the bot can’t see is `404` with `10003`. The reason in `X-Audit-Log-Reason` goes to the
server’s audit log when a thread is changed or deleted; starting one isn’t recorded, as in the app.

## Start a thread from a message

```http
POST /channels/{channel.id}/messages/{message.id}/threads
```

Starts a thread on a message and answers `201` with the [thread](https://docs.klang.gg/bots/reference/objects/#thread).
The thread has **the message’s ID**.

- **Needs**: `CREATE_PUBLIC_THREADS` in the channel. A message the bot wrote or someone else’s, but
  not a system message.
- **Rate limit**: `thread-create`.

| Field                   | Type    | Notes                                                                    |
| ----------------------- | ------- | ------------------------------------------------------------------------ |
| `name`                  | string  | 1 to 100 characters, on one line. The server’s AutoMod word rules apply. |
| `auto_archive_duration` | integer | Accepted and ignored: Klang’s threads go quiet after 7 days.             |
| `rate_limit_per_user`   | integer | Only `0`: a thread takes its channel’s slowmode.                         |

```json
{ "name": "Game night" }
```

```json
{
  "id": "1575149468573831168",
  "type": 11,
  "guild_id": "1575146937681682432",
  "parent_id": "1575146937681682434",
  "name": "Game night",
  "last_message_id": "1575149468645134336",
  "rate_limit_per_user": 0,
  "message_count": 0,
  "total_message_sent": 0,
  "member_count": 0,
  "owner_id": "1575146937547464704",
  "flags": 0,
  "thread_metadata": {
    "archived": false,
    "auto_archive_duration": 10080,
    "archive_timestamp": "2026-11-25T14:01:38.169Z",
    "locked": false,
    "create_timestamp": "2026-11-25T14:01:38.169Z"
  }
}
```

| Status | Code     | When                                 |
| ------ | -------- | ------------------------------------ |
| `400`  | `160004` | The message already has a thread.    |
| `400`  | `50024`  | A system message.                    |
| `400`  | `50035`  | The name isn’t valid.                |
| `400`  | `160006` | The server has 1,000 active threads. |
| `400`  | `200000` | The AutoMod blocked the name.        |
| `403`  | `50013`  | Without the permission.              |
| `404`  | `10008`  | No such message in that channel.     |

## Start a thread on its own

```http
POST /channels/{channel.id}/threads
```

The same, without a message: Klang posts a short note in the channel saying who started it. The
same fields, plus `type`, which can only be `11` (or absent). Private threads (`12`), announcement
threads (`10`) and forum posts (`message`) are a `50035`.

## Change a thread

```http
PATCH /channels/{thread.id}
```

Answers `200` with the thread.

| Field      | Type    | Notes                                                                                 |
| ---------- | ------- | ------------------------------------------------------------------------------------- |
| `name`     | string  | Whoever started it, while they can write in it, or `MANAGE_THREADS`. AutoMod applies. |
| `locked`   | boolean | `MANAGE_THREADS`. Only people who can manage threads write in a locked thread.        |
| `archived` | boolean | Accepted and ignored: see [Before you read](https://docs.klang.gg/bots/reference/threads/#before-you-read).                        |

A channel’s fields, such as `topic` or `permission_overwrites`, are a `50035`, and so is a slowmode
other than `0`.

- **Rate limit**: `thread-manage`.

## Delete a thread

```http
DELETE /channels/{thread.id}
```

Needs `MANAGE_THREADS`, and answers `200` with the thread as it was. The message it started from
stays.

## Join and leave

```http
PUT /channels/{thread.id}/thread-members/@me
DELETE /channels/{thread.id}/thread-members/@me
```

Follows or stops following a thread the bot can see, and answers `204`. Doing it twice changes
nothing. The bot’s own user ID works instead of `@me`. Nobody adds or removes someone else from a
thread in Klang: another user’s ID is `403` with `50013`. The bot gets a
[`THREAD_MEMBERS_UPDATE`](https://docs.klang.gg/bots/reference/gateway-events/#thread_members_update) with itself in
it, as do the other bots with `GUILD_MEMBERS` that see the channel.

- **Rate limit**: `thread-manage`.

## Who follows a thread

```http
GET /channels/{thread.id}/thread-members/{user.id}
GET /channels/{thread.id}/thread-members
```

One person’s [thread member](https://docs.klang.gg/bots/reference/objects/#thread-member), or `404` with `10007` if
they don’t follow it; and the list, by user ID with `after` and `limit` (1 to 100, 100 if absent),
which needs the `GUILD_MEMBERS` intent switched on (`403` with `50001` without it).
`with_member` is ignored.

- **Rate limit**: one, `read-users`; the list, `read-members`.

## Active threads

```http
GET /guilds/{guild.id}/threads/active
```

The active threads of every channel the bot can see, the latest activity first, and in `members`
the bot’s own thread member for those it follows.

```json
{
  "threads": [
    {
      "id": "1575149468573831168",
      "type": 11,
      "name": "Game night",
      "parent_id": "1575146937681682434",
      "thread_metadata": { "archived": false, "locked": false }
    }
  ],
  "members": [
    {
      "id": "1575149468573831168",
      "user_id": "1575146937547464704",
      "join_timestamp": "2026-11-25T14:01:38.170Z",
      "flags": 0
    }
  ]
}
```

- **Rate limit**: `read-guild`.

## Archived threads

```http
GET /channels/{channel.id}/threads/archived/public
```

A channel’s inactive threads, the most recently active first, with `threads`, `members` (the
bot’s own) and `has_more`. Whoever can see the channel sees them.

| Query    | Notes                                                |
| -------- | ---------------------------------------------------- |
| `before` | An ISO 8601 date: threads that went quiet before it. |
| `limit`  | 1 to 100. 50 if absent.                              |

`/threads/archived/private` and the bot’s own private threads don’t exist: Klang has no private
threads.

- **Rate limit**: `thread-list`.
