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.

POST
/updateSession
api-key<token>

API key for authentication. Generate your API key from the Integration settings in your YourGPT dashboard.

In: header

Request Body

application/json

session_uid*string

The unique session identifier obtained from the Get Sessions or Create Session API

state?string

Update the session state. Setting to 'resolved' automatically transfers the session to bot mode. Cannot be combined with chat_mode when set to 'resolved'

Value in"pending" | "unresolved" | "resolved" | "closed"
chat_mode?string

Update the chat mode. 'bot' = AI handles the conversation, 'awaiting' = waiting for operator, 'operator' = human operator handles the conversation

Value in"bot" | "awaiting" | "operator"
segment?string

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

Lengthlength <= 255

Response 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.

ValueDescription
pendingSession is active and waiting for response
unresolvedSession is flagged as unresolved
resolvedSession is resolved. Automatically transfers to bot mode — cannot set chat_mode simultaneously
closedSession is closed

chat_mode

Controls who handles the conversation.

ValueDescription
botAI chatbot handles the conversation
awaitingSession is waiting for a human operator
operatorA 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