---
title: "Update Thread"
url: "https://docs.yoagent.dev/reference/rest-api/operations/updatethread"
---

# Update Thread

PATCH

/v0/threads/{thread_id}

```sh
curl -s -X PATCH "https://api.yoagent.dev/v0/threads/thr_01je56wqswfmn9pgbc1wq8tjgq" \
  -H "Authorization: Bearer $YOAGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"add_labels":["unread"]}'
```

```js
const response = await fetch("https://api.yoagent.dev/v0/threads/thr_01je56wqswfmn9pgbc1wq8tjgq", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.YOAGENT_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "add_labels": [
      "unread"
    ]
  }),
});
if (!response.ok) throw new Error(await response.text());
const data = await response.json();
```

```python
import os

import requests

response = requests.patch(
    "https://api.yoagent.dev/v0/threads/thr_01je56wqswfmn9pgbc1wq8tjgq",
    headers={"Authorization": f"Bearer {os.environ['YOAGENT_KEY']}"},
    json={
        "add_labels": [
            "unread",
        ],
    },
    timeout=60,
)
response.raise_for_status()
data = response.json()
```

- api.yoagent.dev/v0/threads/{thread_id}

Add or remove labels of a thread.

## Authorizations

- **[ApiKey](https://docs.yoagent.dev/reference/rest-api#apikey)**

## Parameters

### Path Parameters

**thread_id**

required

_Thread Id_

string

/^thr\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

## Request Body required

application/json

_ThreadUpdate_

Add or remove labels of a thread.

object

**add_labels**

_Add Labels_

Labels to add: `unread` or the project’s own.

Array\<string>

default: <= 20 items

**remove_labels**

_Remove Labels_

Labels to remove: `unread` (marks it read) or the project’s own.

Array\<string>

default: <= 20 items

## Responses

### 200

Successful Response

application/json

_ThreadItem_

A thread in a list or after a change: no messages.

object

**version**

required

_Version_

Goes up by one on every change: of two copies, the one with the higher version is the newer.

integer

**thread_id**

required

_Thread Id_

string

/^thr\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**inbox_id**

required

_Inbox Id_

string

/^inb\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**subject**

required

_Subject_

Any of:

**string**

string

**null**

null

**labels**

required

_Labels_

Array\<string>

**message_count**

required

_Message Count_

integer

**last_message_at**

required

_Last Message At_

string format: date-time

#### Example

```json
{
  "version": 1,
  "thread_id": "thr_01je56wqswfmn9pgbc1wq8tjgq",
  "inbox_id": "inb_01je56wqswfmn9pgbc1wq8tjgq",
  "subject": "Your sign-in code",
  "labels": [
    "received",
    "unread"
  ],
  "message_count": 1,
  "last_message_at": "2026-12-01T12:00:00Z"
}
```

### default

An error (400, 401, 403, 404, 405, 409, 413, 429, 500, 503), in the one shape every call answers: [Errors](https://docs.yoagent.dev/reference/conventions#errors).
