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

# 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 — Message ID of the asynchronous chat stream to cancel.

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

## Changes

- **2026-06-02** `c711b911f68e` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/zylon-ai/apis/private-gpt-api/changes/v1/messages/async/:message_id/cancel/post.md)

---

[API](https://skmtc.dev/zylon-ai/apis/private-gpt-api.md) · [All operations](https://skmtc.dev/zylon-ai/apis/private-gpt-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/zylon-ai/private-gpt-api/revisions/4e828cf153c4/schema)
