Skip to main content
GET
/
api
/
threads
/
{threadId}
/
messages
curl "https://your-worker.workers.dev/api/threads/550e8400-e29b-41d4-a716-446655440000/messages?limit=50"
{
  "messages": [
    {
      "id": "msg_001",
      "role": "user",
      "content": "Hello, I need help with my order",
      "created_at": 1699900000000,
      "status": "completed"
    },
    {
      "id": "msg_002",
      "role": "assistant",
      "content": "I'd be happy to help you with your order. Could you provide your order number?",
      "created_at": 1699900001000,
      "status": "completed",
      "name": "Support Agent"
    }
  ],
  "hasMore": false
}
Retrieves all messages in a thread.
threadId
string
required
The unique thread identifier (UUID)
limit
number
default:"100"
Maximum number of messages to return
before
string
Return messages before this message ID (for pagination)
after
string
Return messages after this message ID (for pagination)
messages
array
required
Array of message objects
hasMore
boolean
required
Whether more messages exist beyond the current page

Message Object

messages[].id
string
required
Unique message identifier
messages[].role
string
required
Message role: "system", "user", "assistant", or "tool"
messages[].content
string | null
required
Message content (null for tool calls without text)
messages[].name
string | null
Display name (e.g., agent label for assistant messages)
messages[].tool_calls
string | null
JSON string of tool calls made by assistant
messages[].tool_call_id
string | null
ID linking tool result to its call (for tool role messages)
messages[].created_at
number
required
Unix timestamp in milliseconds
messages[].status
string
Message status: "pending", "completed", or "failed"
messages[].depth
number
Nesting depth for sub-prompt messages (0 for top-level)
curl "https://your-worker.workers.dev/api/threads/550e8400-e29b-41d4-a716-446655440000/messages?limit=50"
{
  "messages": [
    {
      "id": "msg_001",
      "role": "user",
      "content": "Hello, I need help with my order",
      "created_at": 1699900000000,
      "status": "completed"
    },
    {
      "id": "msg_002",
      "role": "assistant",
      "content": "I'd be happy to help you with your order. Could you provide your order number?",
      "created_at": 1699900001000,
      "status": "completed",
      "name": "Support Agent"
    }
  ],
  "hasMore": false
}