Cancel a ChatKit session
beta.chatkit.sessions.cancel(session_id) -> ChatSession { id, chatkit_configuration, client_secret, 7 more }
POST
/chatkit/sessions/{session_id}/cancelCancel an active ChatKit session and return its most recent metadata.
Cancelling prevents new requests from using the issued client secret.
Cancel a ChatKit session
require "openai"
openai = OpenAI::Client.new
chat_session = openai.beta.chatkit.sessions.cancel("cksess_123")
puts(chat_session)
Response example
{
"id": "cksess_123",
"object": "chatkit.session",
"client_secret": "",
"expires_at": 1735689600,
"workflow": {
"id": "workflow_alpha",
"version": null,
"state_variables": null,
"tracing": {
"enabled": true
}
},
"user": "user_123",
"rate_limits": {
"max_requests_per_1_minute": 10
},
"max_requests_per_1_minute": 10,
"status": "cancelled",
"chatkit_configuration": {
"automatic_thread_titling": {
"enabled": true
},
"file_upload": {
"enabled": false,
"max_file_size": 512,
"max_files": 10
},
"history": {
"enabled": true,
"recent_threads": null
}
}
}
Returns Examples
Response example
{
"id": "cksess_123",
"object": "chatkit.session",
"client_secret": "",
"expires_at": 1735689600,
"workflow": {
"id": "workflow_alpha",
"version": null,
"state_variables": null,
"tracing": {
"enabled": true
}
},
"user": "user_123",
"rate_limits": {
"max_requests_per_1_minute": 10
},
"max_requests_per_1_minute": 10,
"status": "cancelled",
"chatkit_configuration": {
"automatic_thread_titling": {
"enabled": true
},
"file_upload": {
"enabled": false,
"max_file_size": 512,
"max_files": 10
},
"history": {
"enabled": true,
"recent_threads": null
}
}
}