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.
Retrieve a paginated list of chat sessions for your project with filtering and sorting options.
Authorization
apiKey
API key for authentication. Generate your API key from the Integration settings in your YourGPT dashboard.
In: header
Request Body
application/json
Start date for filtering sessions (YYYY-MM-DD)
dateEnd date for filtering sessions (YYYY-MM-DD). Defaults to today
dateSort order by last message time. Defaults to ASC
"ASC" | "DESC"Number of sessions per page (max 100). Defaults to 10
value <= 100Page number for pagination. Defaults to 1
ID of a saved view. Found at the end of the URL: /conversations/my-view-{id}
Advanced filters array. See the Filter Guide section below for details on how to build filters.
Response Body
application/json
application/json
application/json
curl -X POST "https://api.yourgpt.ai/chatbot/v1/getSessions" \ -H "Content-Type: application/json" \ -d '{}'{
"type": "RXSUCCESS",
"message": "string",
"data": [
{
"id": 0,
"project_id": 0,
"session_uid": "string",
"integration_id": 0,
"status": "string",
"device_type": "string",
"platform": "string",
"chat_mode": "string",
"ip": "string",
"country": "string",
"segment": "string",
"data": {},
"state": "string",
"contact_id": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"total_unseen": "string",
"last_message_time": "2019-08-24T14:15:22Z",
"last_message": "string",
"last_message_id": 0,
"last_message_content_type": "string",
"last_message_type": 0,
"visitor_data": {},
"contact_data": {},
"session_meta": {}
}
]
}{
"type": "RXERROR",
"message": "string"
}{
"type": "RXERROR",
"message": "string"
}Filter Guide
The filter parameter allows you to build advanced queries by combining multiple conditions. Each filter is an object with 4 required fields:
{ "model": "SESSION", "key": "...", "operator": "...", "value": "..." }How to Build a Filter
Set Model — Always use SESSION
Choose a Key — Select a field to filter on (see table below)
Choose an Operator — Pick a comparison: eq, ne, gt, gte, lt, lte, startsWith, endsWith, in, notIn
Set the Value — The value to compare against
Available Filter Keys
| Key | Description | Accepted Values |
|---|---|---|
integration | Filter by integration channel | web, whatsapp, telegram, messenger, instagram, line, discord, slack, intercom, crisp, email, twilio_sms, twilio_voice, twilio_whatsapp, phone, web_voice, browser_extension |
chat_mode | Filter by chat mode | bot, awaiting, operator |
state | Session state | pending, unresolved, resolved, closed |
contact_id | Filter by contact ID. Found at the end of the URL: /contacts/list/all/{id} | Contact ID number |
visitor_id | Filter by visitor ID | Visitor ID number |
Operators
| Operator | Description | Example |
|---|---|---|
eq | Equal to | { "operator": "eq", "value": "whatsapp" } |
ne | Not equal to | { "operator": "ne", "value": "resolved" } |
gt | Greater than | { "operator": "gt", "value": "100" } |
gte | Greater than or equal | { "operator": "gte", "value": "5" } |
lt | Less than | { "operator": "lt", "value": "50" } |
lte | Less than or equal | { "operator": "lte", "value": "10" } |
startsWith | Starts with | { "operator": "startsWith", "value": "US" } |
endsWith | Ends with | { "operator": "endsWith", "value": "com" } |
in | In a list of values | { "operator": "in", "value": ["pending", "resolved"] } |
notIn | Not in a list of values | { "operator": "notIn", "value": ["resolved"] } |
Examples
Tip
You can combine the filter parameter with top-level parameters like from, to, orderBy, and view_id for even more precise queries.
Create Session (Project API Key)
Create a new chatbot session using your project API Key. You must create a session before sending messages. The session_uid returned from this endpoint is required for the Send Message API.
Update Session (Project API Key)
Update a session's state, chat mode, or segment tags using your project API Key.