---
title: "Cancel a ChatKit session"
method: POST
path: "/chatkit/sessions/{session_id}/cancel"
---

# Cancel a ChatKit session

`POST /chatkit/sessions/{session_id}/cancel`

## Request

- Base URL: `https://api.openai.com/v1`
- URL: `https://api.openai.com/v1/chatkit/sessions/{session_id}/cancel`
- Auth: HTTP bearer

Cancel an active ChatKit session and return its most recent metadata.

Cancelling prevents new requests from using the issued client secret.

## Path parameters

- `session_id` string, required

## Response `200`

Success

- ChatSessionResource: Represents a ChatKit session and its resolved configuration.
  - `id` string, required: Identifier for the ChatKit session.
  - `object` 'chatkit.session', required: Type discriminator that is always `chatkit.session`.
  - `expires_at` integer, required: Unix timestamp (in seconds) for when the session expires.
  - `client_secret` string, required: Ephemeral client secret that authenticates session requests.
  - `workflow` ChatkitWorkflow, required: Workflow metadata and state returned for the session.
    - `id` string, required: Identifier of the workflow backing the session.
    - `version` string, nullable, required: Specific workflow version used for the session. Defaults to null when using the latest deployment.
    - `state_variables` object, nullable, required: State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.
    - `tracing` ChatkitWorkflowTracing, required: Controls diagnostic tracing during the session.
      - `enabled` boolean, required: Indicates whether tracing is enabled.
  - `user` string, required: User identifier associated with the session.
  - `rate_limits` ChatSessionRateLimits, required: Active per-minute request limit for the session.
    - `max_requests_per_1_minute` integer, required: Maximum allowed requests per one-minute window.
  - `max_requests_per_1_minute` integer, required: Convenience copy of the per-minute request limit.
  - `status` 'active' | 'expired' | 'cancelled', required
  - `chatkit_configuration` ChatSessionChatkitConfiguration, required: ChatKit configuration for the session.
    - `automatic_thread_titling` ChatSessionAutomaticThreadTitling, required: Automatic thread title preferences for the session.
      - `enabled` boolean, required: Whether automatic thread titling is enabled.
    - `file_upload` ChatSessionFileUpload, required: Upload permissions and limits applied to the session.
      - `enabled` boolean, required: Indicates if uploads are enabled for the session.
      - `max_file_size` integer, nullable, required: Maximum upload size in megabytes.
      - `max_files` integer, nullable, required: Maximum number of uploads allowed during the session.
    - `history` ChatSessionHistory, required: History retention preferences returned for the session.
      - `enabled` boolean, required: Indicates if chat history is persisted for the session.
      - `recent_threads` integer, nullable, required: Number of prior threads surfaced in history views. Defaults to null when all history is retained.

## Other responses

- `400`: The request is invalid or the required ChatKit beta header is missing or invalid.
- `404`: The session was not found or is not accessible.
- `429`: The request rate limit has been exceeded.

## Changes

- **2026-10-06** `487892d3954e`: 3 info
  - added the optional property `error/misalignment/review_target` to the response with the `400` status
  - added the optional property `error/misalignment/review_target` to the response with the `404` status
  - added the optional property `error/misalignment/review_target` to the response with the `429` status
- **2026-10-05** `7f654af7f94f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/omnistack-sh/apis/openai-api/changes/chatkit/sessions/:session_id/cancel/post.md)

---

[API](https://skmtc.dev/omnistack-sh/apis/openai-api.md) - [All operations](https://skmtc.dev/omnistack-sh/apis/openai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/omnistack-sh/apis/openai-api/revisions/0a26f104d35f?raw)
