---
title: "Stop the reply being written"
method: POST
path: "/assistant/threads/{threadId}/messages/{messageId}/cancel"
tags: ["Assistant"]
---

# Stop the reply being written

`POST /assistant/threads/{threadId}/messages/{messageId}/cancel`

Records a Stop for the assistant message being produced. The turn, on whichever instance runs it, notices within about a second, aborts its gateway call, saves what completed (status error, finishReason cancelled) and, if the stream is still attached, ends it with done{finishReason:"cancelled"}. The tokens already spent are recorded but not charged. status is cancelling when the reply was running, not_running when it had already finished. 404 for a message that is not the caller's. Requires org.view_dashboard.

## Path parameters

- `threadId` string, required
- `messageId` string, required

## Response `200`

The Stop is recorded (or there was nothing to stop)

- AssistantCancelResponse
  - `data` object, required
    - `messageId` string, required
    - `status` string, required — cancelling or not_running

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found

## Changes

- **2026-10-01** `b4751fd15397` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/greentally/apis/esgai-api/changes/assistant/threads/:threadId/messages/:messageId/cancel/post.md)

---

[API](https://skmtc.dev/greentally/apis/esgai-api.md) · [All operations](https://skmtc.dev/greentally/apis/esgai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/greentally/apis/esgai-api/revisions/b4751fd15397?raw)
