---
title: "Cancel Async Chat Stream"
method: POST
path: "/v1/messages/async/{message_id}/cancel"
tags: ["asyncMessages"]
---

# Cancel Async Chat Stream

`POST /v1/messages/async/{message_id}/cancel`

Cancel an active asynchronous chat stream.

This endpoint gracefully cancels an ongoing chat completion stream by:
1. Setting the cancellation token to stop the event generation loop
2. Cancelling the underlying asyncio task
3. Updating the stream status to 'cancelled'

Notes:
* Cancellation is irreversible - stream cannot be resumed
* Any active SSE connections will receive a final event and close
* Stream status will be updated to reflect cancellation
* Use DELETE endpoint to remove cancelled streams from storage

## Path parameters

- `message_id` string, required

## Request body

- object

## Response `200`

Stream cancelled successfully

- ChatCancellationResponse — Response model for cancelled asynchronous chat streams
  - `message` string, required — Confirmation message for successful stream cancellation
  - `message_id` string, required — Unique identifier of the cancelled stream

## Other responses

- `401` — Unauthorized
- `404` — Stream not found
- `422` — Validation Error

---

[API](https://skmtc.dev/privategpt/apis/api-reference.md) · [All operations](https://skmtc.dev/privategpt/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/privategpt/api-reference/revisions/15d9ccfd68da/schema)
