---
title: "Update a thread"
description: "Update a chat thread's title and/or metadata."
---

> Documentation Index
> Fetch the complete documentation index at: https://truememory-docs.mvstg.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: AI Gateway API › History & Feedback

`PATCH /threads/{thread_id}`

Update a chat thread's title and/or metadata.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Path parameters

- `thread_id` (`update_thread.path.thread_id`; string, required)

## Header parameters

- `x-app-id` (`update_thread.header.x-app-id`; any of, optional) — Application ID for scoping threads
  - any of: `string`, `null`
- `X-On-Behalf-Of` (`update_thread.header.X-On-Behalf-Of`; any of, optional)
  - any of: `string`, `null`
- `X-External-User-Id` (`update_thread.header.X-External-User-Id`; any of, optional)
  - any of: `string`, `null`
- `X-App-Id` (`update_thread.header.X-App-Id`; any of, optional)
  - any of: `string`, `null`

## Request body

_Required._

- `title` (`update_thread.title`; any of, optional) — New title for the thread.
  - any of: `string`, `null`
- `metadata` (`update_thread.metadata`; any of, optional) — Arbitrary metadata dict for the thread (e.g. source, pageType, isPinned).
  - any of: `object`, `null`

## Example request

```json
{
  "title": "My conversation about weather",
  "metadata": {
    "isPinned": false,
    "pageType": "whatsapp-dm",
    "source": "whatsapp"
  }
}
```

## Code samples

### cURL

```bash
curl --request PATCH \
  --url 'https://truememory-api.mvstg.com/threads/<thread_id>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "My conversation about weather",
  "metadata": {
    "isPinned": false,
    "pageType": "whatsapp-dm",
    "source": "whatsapp"
  }
}
'
```

### TypeScript

```typescript
const url = 'https://truememory-api.mvstg.com/threads/<thread_id>';
const options = {
  method: 'PATCH',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    title: 'My conversation about weather',
    metadata: {isPinned: false, pageType: 'whatsapp-dm', source: 'whatsapp'}
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://truememory-api.mvstg.com/threads/<thread_id>"

payload = {
    "title": "My conversation about weather",
    "metadata": {
        "isPinned": False,
        "pageType": "whatsapp-dm",
        "source": "whatsapp"
    }
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Successful Response

#### Example

```json
{
  "thread_id": "847c6285-8fc9-4560-a83f-4e6285809254",
  "agent_id": "chatbot",
  "app_id": "vibrantly",
  "title": "What is the weather in Tokyo?",
  "metadata": {
    "isPinned": false,
    "source": "whatsapp"
  },
  "created_at": "string",
  "updated_at": "string"
}
```

- `thread_id` (`update_thread.response.200.thread_id`; string, required) — Thread ID (session_key).
- `agent_id` (`update_thread.response.200.agent_id`; string, required) — Agent that handled this thread.
- `created_at` (`update_thread.response.200.created_at`; string, required) — When the thread was created (ISO 8601).
- `updated_at` (`update_thread.response.200.updated_at`; string, required) — When the thread was last updated (ISO 8601).
- `app_id` (`update_thread.response.200.app_id`; any of, optional) — Application scope for this thread. None if unscoped.
  - any of: `string`, `null`
- `title` (`update_thread.response.200.title`; any of, optional) — Thread title derived from the first user message.
  - any of: `string`, `null`
- `metadata` (`update_thread.response.200.metadata`; any of, optional) — Arbitrary metadata dict for the thread.
  - any of: `object`, `null`

### 422

Validation Error

#### Example

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

- `detail` (`update_thread.response.422.detail`; array<object>, optional)
  - `loc` (`update_thread.response.422.detail.loc`; array<any of>, required)
    - any of: `string`, `integer`
  - `msg` (`update_thread.response.422.detail.msg`; string, required)
  - `type` (`update_thread.response.422.detail.type`; string, required)
  - `input` (`update_thread.response.422.detail.input`; unknown, optional)
  - `ctx` (`update_thread.response.422.detail.ctx`; object, optional)


Source: https://truememory-docs.mvstg.com/api/threads/update/index.md
