> ## 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.

# Delete Thread

Deletes a thread and its full descendant tree (all subthreads), including all associated messages and thread storage.

Every open stream connection to a deleted thread is closed with WebSocket close code `1000` before the response is returned.

> [!WARNING]
>
> This action is irreversible. The selected thread and all descendant subthreads are permanently deleted.

**threadId** `string` *required*

The unique thread identifier (UUID)

**success** `boolean` *required*

Whether the deletion was successful

**threadId** `string` *required*

The root thread ID that was requested for deletion

**deletedThreadIds** `array[string]` *required*

Thread IDs deleted in child-first order

**deletedCount** `number` *required*

Total number of deleted threads (root + descendants)

```bash cURL theme={null}
curl -X DELETE https://your-worker.workers.dev/api/threads/550e8400-e29b-41d4-a716-446655440000
```

```typescript JavaScript theme={null}
const response = await fetch(
  'https://your-worker.workers.dev/api/threads/550e8400-e29b-41d4-a716-446655440000',
  { method: 'DELETE' }
);
const result = await response.json();
```

```json 200 theme={null}
{
  "success": true,
  "threadId": "550e8400-e29b-41d4-a716-446655440000",
  "deletedThreadIds": [
    "4dcf9e6e-9b72-4435-bf1a-b402f488f012",
    "c3ba3a6a-0cc7-4f90-a8e8-9cd664f9fe11",
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "deletedCount": 3,
  "message": "Thread and subthreads deleted successfully"
}
```

```json 404 theme={null}
{
  "error": "Thread not found"
}
```


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