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

# Cancel chat session

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

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.

---

[API](https://skmtc.net/openai/apis/openai-api.md) · [All operations](https://skmtc.net/openai/apis/openai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openai/openai-api/versions/dcd35773a322/schema)
