v1

latestOpenAPI 3.0.02026-07-174565114.3 KB
v1

List messages

List messages in a thread. Supports cursor-based pagination and ordering.

get/v1/threads/{threadId}/messages

Path parameters

threadIdstring required
Example:thr_abc123xyz

Thread ID

Query parameters

limitnumber

Maximum number of messages to return

cursorstring

Cursor for pagination

order'asc' | 'desc'

Sort order: 'asc' for oldest first, 'desc' for newest first

userKeystring

Identifier for a user in your system. Required if no bearer token is provided.

Response

List of messages

nextCursorstring

Cursor for the next page of results

hasMoreboolean required

Whether there are more results

Example response

{
  "messages": [
    {
      "id": "msg_abc123xyz",
      "role": "assistant",
      "content": [
        {
          "type": "text",
          "text": "Hello, world!"
        }
      ],
      "createdAt": "2024-01-15T12:00:00Z"
    }
  ]
}