---
title: "Stop the AI turn running in a conversation"
method: POST
path: "/api/{org_id}/ai/chats/{session_id}/cancel"
tags: ["AI"]
---

# Stop the AI turn running in a conversation

`POST /api/{org_id}/ai/chats/{session_id}/cancel`

## Request

- Base URL: `https://api.openobserve.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.openobserve.ai/api/{org_id}/ai/chats/{session_id}/cancel`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/api/:org_id/ai/chats/:session_id/cancel/post.ts> (a function with typed inputs; its response is checked against the schema)

Stops generation for a chat session. With server-side chat persistence enabled the browser no longer holds the connection to the agent, so disconnecting does not stop the turn — this does, and what was generated up to that point stays saved.

## Path parameters

- `org_id` string, required
- `session_id` string, required

## Request body

- object

## Response `200`

Cancellation forwarded

- object

## Other responses

- `400`: Invalid session ID or AI agent not configured
- `403`: The conversation belongs to another user
- `404`: Unknown conversation
- `415`: The body is not JSON (send {})
- `500`: Internal Server Error

---

[API](https://skmtc.dev/openobserve/apis/openobserve-api-http.md) - [All operations](https://skmtc.dev/openobserve/apis/openobserve-api-http/llms.txt) - [OpenAPI document](https://skmtc.dev/openobserve/apis/openobserve-api-http/revisions/0529b8a10252?raw)
