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.

POST
/getSessions
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

from?string

Start date for filtering sessions (YYYY-MM-DD)

Formatdate
to?string

End date for filtering sessions (YYYY-MM-DD). Defaults to today

Formatdate
orderBy?string

Sort order by last message time. Defaults to ASC

Value in"ASC" | "DESC"
limit?integer

Number of sessions per page (max 100). Defaults to 10

Rangevalue <= 100
page?integer

Page number for pagination. Defaults to 1

view_id?integer

ID of a saved view. Found at the end of the URL: /conversations/my-view-{id}

filter?

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

KeyDescriptionAccepted Values
integrationFilter by integration channelweb, whatsapp, telegram, messenger, instagram, line, discord, slack, intercom, crisp, email, twilio_sms, twilio_voice, twilio_whatsapp, phone, web_voice, browser_extension
chat_modeFilter by chat modebot, awaiting, operator
stateSession statepending, unresolved, resolved, closed
contact_idFilter by contact ID. Found at the end of the URL: /contacts/list/all/{id}Contact ID number
visitor_idFilter by visitor IDVisitor ID number

Operators

OperatorDescriptionExample
eqEqual to{ "operator": "eq", "value": "whatsapp" }
neNot equal to{ "operator": "ne", "value": "resolved" }
gtGreater than{ "operator": "gt", "value": "100" }
gteGreater than or equal{ "operator": "gte", "value": "5" }
ltLess than{ "operator": "lt", "value": "50" }
lteLess than or equal{ "operator": "lte", "value": "10" }
startsWithStarts with{ "operator": "startsWith", "value": "US" }
endsWithEnds with{ "operator": "endsWith", "value": "com" }
inIn a list of values{ "operator": "in", "value": ["pending", "resolved"] }
notInNot 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.