Skip to main content
GET
/
v1
/
sessions
/
{sessionId}
/
messages
curl --request GET \
  --url 'https://api.synthra.ai/v1/sessions/session_abc123def456/messages?limit=20' \
  --header 'Authorization: Bearer synthra_live_abc123def456'
{
  "data": [
    {
      "messageId": "msg_abc123def456",
      "sessionId": "session_abc123def456",
      "role": "user",
      "content": "Hello, Synthra!",
      "tokens": 4,
      "createdAt": "2024-03-08T14:30:00Z"
    },
    {
      "messageId": "msg_xyz789ghi012",
      "sessionId": "session_abc123def456",
      "role": "assistant",
      "content": "Hello! How can I help you today?",
      "tokens": 8,
      "createdAt": "2024-03-08T14:30:01Z"
    }
  ],
  "pagination": {
    "hasMore": true,
    "nextCursor": "msg_xyz789ghi012"
  }
}

Authorization

Authorization
string
required
Bearer token. Format: Bearer synthra_live_abc123def456

Path Parameters

sessionId
string
required
Unique session identifier. Format: session_<16 chars>

Query Parameters

limit
number
default:"50"
Maximum number of messages to return. Max: 100
cursor
string
Cursor for pagination. Use nextCursor from previous response.
order
string
default:"desc"
Sort order. Options: asc, desc

Response

data
array
Array of message objects
pagination
object
Pagination metadataProperties:
  • hasMore (boolean): Whether more messages exist
  • nextCursor (string): Cursor for next page
curl --request GET \
  --url 'https://api.synthra.ai/v1/sessions/session_abc123def456/messages?limit=20' \
  --header 'Authorization: Bearer synthra_live_abc123def456'
{
  "data": [
    {
      "messageId": "msg_abc123def456",
      "sessionId": "session_abc123def456",
      "role": "user",
      "content": "Hello, Synthra!",
      "tokens": 4,
      "createdAt": "2024-03-08T14:30:00Z"
    },
    {
      "messageId": "msg_xyz789ghi012",
      "sessionId": "session_abc123def456",
      "role": "assistant",
      "content": "Hello! How can I help you today?",
      "tokens": 8,
      "createdAt": "2024-03-08T14:30:01Z"
    }
  ],
  "pagination": {
    "hasMore": true,
    "nextCursor": "msg_xyz789ghi012"
  }
}