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

# Stop Thread

Stops the execution in flight on a thread. The request has no body.

When an execution is in flight, the runtime aborts it:

* The run settles as `idle` with reason `aborted_by_user`. The [WebSocket stream](https://docs.standardagents.ai/api-reference/websocket/stream.md) sends a `thread_status` frame with that status.
* `state.execution.abortSignal` fires in the running tool or hook.
* Each tool call that has no result receives a tool message with the content `Execution stopped by user` and `tool_status` `error`.
* Each message with status `pending` changes to `failed`.
* The thread stores one `system` message with the content `Execution stopped by user`.
* The stream sends a `stopped_by_user` telemetry frame.

The route is idempotent. A request to a thread with no execution in flight returns the same `200` response. That request stores no stop message and sends no `stopped_by_user` frame.

The thread stays available after a stop. The next message starts a new execution with the history intact.

**threadId** `string` *required*

The unique thread identifier (UUID)

**status** `string` *required*

Always `stopped`

**message** `string` *required*

A fixed description: `Thread execution stopped`

```bash cURL theme={null}
curl -X POST https://your-worker.workers.dev/api/threads/550e8400-e29b-41d4-a716-446655440000/stop \
  -H "Authorization: Bearer $STANDARD_AGENTS_API_KEY"
```

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

```typescript Client SDK theme={null}
import { AgentBuilderClient } from '@standardagents/client';

const client = new AgentBuilderClient('https://your-worker.workers.dev/api');
await client.stopExecution('550e8400-e29b-41d4-a716-446655440000');
```

```json 200 theme={null}
{
  "status": "stopped",
  "message": "Thread execution stopped"
}
```

```json 404 theme={null}
{
  "error": {
    "code": "not_found",
    "message": "Thread not found: 550e8400-e29b-41d4-a716-446655440000"
  },
  "requestId": "0b3c1f0e-7f0a-4a55-9c58-2f6f5a0f6f0e"
}
```


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