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

# Stop a Reply

> Stop a reply while it is being written

## Overview

Stops a running reply at its next safe point. Whatever the assistant had already said is kept and marked as stopped. A streaming reply ends with `done` carrying `stopped: true`. Calling it again, or after the reply finished, returns the same result.

Operation name: `run.cancel`. Member keys can call it.

## Authorization

**x-api-key** `string` *required*

Your Composer API key

## Headers

**Content-Type** `string` *required*

Must be set to application/json

## Body

**run\_id** `string` *required*

The reply's id: the first `run` event of a streaming chat, or `run_id` from Chat.

```json Example theme={null}
"run_id": "3f8e2a1b-7c6d-4e5f-9a8b-0c1d2e3f4a5b"
```

**conversation\_id** `string` *required*

The conversation the reply belongs to.

```json Example theme={null}
"conversation_id": "9a2b7c1e-4d3f-4e8a-b6c5-1f0e2d3c4b5a"
```

```json Example Request theme={null}
{
  "run_id": "3f8e2a1b-7c6d-4e5f-9a8b-0c1d2e3f4a5b",
  "conversation_id": "9a2b7c1e-4d3f-4e8a-b6c5-1f0e2d3c4b5a"
}
```

***

## Response

**run\_id** `string`

The reply that was stopped.

**stop\_requested** `boolean`

Always true.

```json Example Success Response theme={null}
{
  "run_id": "3f8e2a1b-7c6d-4e5f-9a8b-0c1d2e3f4a5b",
  "stop_requested": true
}
```

***

## Example cURL

```bash cURL theme={null}
curl --request POST 'https://composer.personal.ai/lab/api/v1/op/run.cancel' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{"run_id": "3f8e2a1b-7c6d-4e5f-9a8b-0c1d2e3f4a5b", "conversation_id": "9a2b7c1e-4d3f-4e8a-b6c5-1f0e2d3c4b5a"}'
```

***

## Error Codes

| Code | Description |
| - | - |
| 400 | The body doesn't match the fields above, or the operation failed. The response body says why. |
| 401 | Missing or invalid API key |
| 403 | This key isn't allowed to call this operation |


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