---
title: "Cancel Session Task"
method: POST
path: "/api/chat/sessions/{session_id}/cancel"
tags: ["v2", "chat", "chat"]
---

# Cancel Session Task

`POST /api/chat/sessions/{session_id}/cancel`

Cancel the active streaming task for a session.

Publishes a cancel event to the executor via RabbitMQ FANOUT, then
polls Redis until the task status flips from ``running`` or a timeout
(5 s) is reached.  Returns only after the cancellation is confirmed.

## Path parameters

- `session_id` string, required

## Response `200`

Successful Response

- CancelSessionResponse — Response model for the cancel session endpoint.
  - `cancelled` boolean, required
  - `reason` string, nullable

## Other responses

- `401` — Authentication required
- `422` — Validation Error

---

[API](https://skmtc.dev/significant-gravitas/apis/autogpt-agent-server.md) · [All operations](https://skmtc.dev/significant-gravitas/apis/autogpt-agent-server/llms.txt) · [OpenAPI document](https://skmtc.dev/significant-gravitas/apis/autogpt-agent-server/revisions/72eaad2d41b3?raw)
