Create ChatKit session
client.beta.chatkit.sessions.create(SessionCreateParams { user, workflow, chatkit_configuration, 2 more } body, RequestOptionsoptions?): ChatSession { id, chatkit_configuration, client_secret, 7 more }
POST/chatkit/sessions
Create ChatKit session
import OpenAI from 'openai';
const client = new OpenAI();
const chatSession = await client.beta.chatkit.sessions.create({ user: 'user', workflow: { id: 'id' } });
console.log(chatSession.id);
{
"client_secret": "chatkit_token_123",
"expires_at": 1735689600,
"workflow": {
"id": "workflow_alpha",
"version": "2024-10-01"
},
"scope": {
"project": "alpha",
"environment": "staging"
},
"max_requests_per_1_minute": 60,
"max_requests_per_session": 500,
"status": "active"
}
Returns Examples
{
"client_secret": "chatkit_token_123",
"expires_at": 1735689600,
"workflow": {
"id": "workflow_alpha",
"version": "2024-10-01"
},
"scope": {
"project": "alpha",
"environment": "staging"
},
"max_requests_per_1_minute": 60,
"max_requests_per_session": 500,
"status": "active"
}