Update Session (Project API Key)
Update a session's state, chat mode, or segment tags using your project API Key.
Update session properties such as state, chat mode, or segment. If state is set to resolved, the session switches to bot mode automatically.
Authorization
apiKey
API key for authentication. Generate your API key from the Integration settings in your YourGPT dashboard.
In: header
Request Body
application/json
The unique session identifier obtained from the Get Sessions or Create Session API
Update the session state. Setting to 'resolved' automatically transfers the session to bot mode. Cannot be combined with chat_mode when set to 'resolved'
"pending" | "unresolved" | "resolved" | "closed"Update the chat mode. 'bot' = AI handles the conversation, 'awaiting' = waiting for operator, 'operator' = human operator handles the conversation
"bot" | "awaiting" | "operator"Comma-separated segment tags for the session (e.g. 'vip,priority'). This replaces the entire segment value — to append, include the existing segments along with the new ones
length <= 255Response Body
application/json
application/json
application/json
curl -X POST "https://api.yourgpt.ai/chatbot/v1/updateSession" \ -H "Content-Type: application/json" \ -d '{ "session_uid": "string" }'{
"type": "RXSUCCESS",
"message": "Session updated successfully",
"data": {
"id": 12345,
"project_id": 100,
"session_uid": "17000000000000000",
"integration_id": 3,
"status": null,
"device_type": "desktop",
"platform": null,
"chat_mode": "1",
"ip": null,
"country": null,
"segment": "vip,priority",
"state": "pending",
"contact_id": null,
"visitor_id": null,
"is_emulator": false,
"data": {},
"language": null,
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:05:00.000Z"
}
}{
"type": "RXERROR",
"message": "string"
}{
"type": "RXERROR",
"message": "string"
}Field Details
state
Controls the session lifecycle.
| Value | Description |
|---|---|
pending | Session is active and waiting for response |
unresolved | Session is flagged as unresolved |
resolved | Session is resolved. Automatically transfers to bot mode — cannot set chat_mode simultaneously |
closed | Session is closed |
chat_mode
Controls who handles the conversation.
| Value | Description |
|---|---|
bot | AI chatbot handles the conversation |
awaiting | Session is waiting for a human operator |
operator | A human operator is handling the conversation |
Conflict
You cannot set chat_mode when state is resolved. Resolved sessions are automatically transferred to bot mode.
segment
Comma-separated tags for categorizing the session (e.g. vip,priority,enterprise). Maximum 255 characters.
Replacement Behavior
The segment field replaces the entire value. To append new segments, include the existing segments along with the new ones. For example, if the current segment is vip and you want to add priority, send vip,priority.
Examples
Get Sessions (Project API Key)
Retrieve a paginated list of chat sessions for your project using your project API Key, with filtering and sorting options.
Send Message (Project API Key)
Send a message in a chat session using your project API Key. Use send_by to control whether the message is from the user, operator, or assistant.