---
title: "Label a conversation"
method: PATCH
path: "/v1/threads/{thread_id}"
tags: ["threads"]
---

# Label a conversation

`PATCH /v1/threads/{thread_id}`

## Request

- Base URL: `https://cherami.to`
- URL: `https://cherami.to/v1/threads/{thread_id}`
- Auth: HTTP bearer

Adds and removes labels on every message currently in the conversation, received and sent, leaving their other labels as they are. The [label rules](https://cherami.to/docs/api/labels/update-message-labels) apply. Messages that arrive later don't get the labels.

The counts cover every message updated, including those that already matched, and `add_labels` and `remove_labels` echo the change rather than each message's labels.

## Path parameters

- `thread_id` string, required

## Request body

- LabelChange: At least one array must contain a label, and a name can't be in both.
  - `add_labels` Label[]: Label names, case-sensitive; order and duplicates don't matter.
  - `remove_labels` Label[]: Label names, case-sensitive; order and duplicates don't matter.

## Response `200`

Success.

- ThreadLabelResult
  - `id` string, required: Cherami resource ID.
  - `inbox_id` string, required: Cherami resource ID.
  - `message_count` integer, required
  - `received_count` integer, required
  - `sent_count` integer, required
  - `add_labels` string[], required
  - `remove_labels` string[], required

## Other responses

- `400`: `invalid_json`: Send a valid UTF-8 JSON object, not an array or scalar. `invalid_labels`: Correct the label name, label change, filter group or discovery prefix the message names.
- `401`: `unauthorized`: Send a valid API key as `Authorization: Bearer <key>`. If the key stopped working, get a new one through [recovery](https://cherami.to/docs/guides/recovery).
- `404`: `not_found`: The resource does not exist or does not belong to this account. A reply or forward source must also be in the sending inbox.
- `413`: `body_too_large`: Reduce the JSON request to the operation's body limit.
- `415`: `unsupported_media_type`: Send `Content-Type: application/json`.
- `500`: `internal_error`: The operation failed. Retry a read; after a write the change may have happened, so recover as [retry by operation](https://cherami.to/docs/api/errors#retry-by-operation) describes.

---

[API](https://skmtc.dev/cherami/apis/cherami-http-api.md) · [All operations](https://skmtc.dev/cherami/apis/cherami-http-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cherami/apis/cherami-http-api/revisions/7bd993d538af?raw)
