> ## Documentation Index
> Fetch the complete documentation index at: https://docs.standardagents.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Thread

Updates thread properties including tags and agent assignment.

**threadId** `string` *required*

The unique thread identifier (UUID)

**tags** `array`

Array of string tags (replaces existing tags)

**agent\_id** `string`

New agent to assign to the thread (must be an `ai_human` type agent)

### Errors

A request is rejected with `400`, and the thread is unchanged, when the body is not a JSON object, when `tags` is not an array of strings, or when the body names no field to update.

### Response

Returns the updated thread object.

**id** `string` *required*

Thread identifier

**agent\_id** `string` *required*

The agent name associated with this thread

**user\_id** `string | null`

User identifier if set

**tags** `array` *required*

Array of string tags

**created\_at** `number` *required*

Unix timestamp in seconds

```bash cURL theme={null}
curl -X PATCH https://your-worker.workers.dev/api/threads/550e8400-e29b-41d4-a716-446655440000 \
  -H "Content-Type: application/json" \
  -d '{
    "tags": ["support", "escalated", "priority"]
  }'
```

```typescript JavaScript theme={null}
const response = await fetch(
  'https://your-worker.workers.dev/api/threads/550e8400-e29b-41d4-a716-446655440000',
  {
    method: 'PATCH',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      tags: ['support', 'escalated', 'priority']
    })
  }
);
const result = await response.json();
```

```json 200 theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "agent_id": "support_agent",
  "user_id": "user_abc123",
  "tags": ["support", "escalated", "priority"],
  "created_at": 1699900000
}
```

```json 400 theme={null}
{
  "error": "No valid fields to update"
}
```

```json 404 theme={null}
{
  "error": "Thread not found: 550e8400-e29b-41d4-a716-446655440000"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.