Retrieve all messages from a specific thread with pagination support. Returns messages in chronological order with full content and metadata.
For messages where role is assistant, the response may include toolCalls and iterations arrays, providing detailed insight into the model's execution process.
toolCalls: An array of objects detailing any tools the model invoked to generate the response. Each object includes the function name, arguments, and the result returned by the tool.iterations: An array of objects that captures the model's reasoning or "thought process" steps. This is useful for debugging and understanding how the model arrived at its final answer.
These fields will only be present if the assistant used tools or went through reasoning steps to generate the message.
thread_id string required
The unique identifier of the thread to retrieve messages from.
limit integer optional · Defaults to 20
Number of messages to return. Must be between 1 and 100.
order string optional · Defaults to asc
Sort order for messages. Available values: asc (oldest first), desc (newest first).
after string optional
Cursor for pagination. Returns messages created after the specified message ID.
before string optional
Cursor for pagination. Returns messages created before the specified message ID.
- Bash
- Python
- JavaScript
curl "https://api.freddy.aitronos.com/v1/threads/thread_abc123/messages?limit=20" \
-H "Authorization: Bearer $FREDDY_API_KEY"{
"object": "list",
"data": [
{
"id": "msg_abc123",
"object": "thread.message",
"createdAt": 1741476542,
"threadId": "thread_abc123",
"role": "user",
"content": [
{
"type": "text",
"text": "Hello, I need help with billing"
}
],
"metadata": {}
},
{
"id": "msg_xyz789",
"object": "thread.message",
"createdAt": 1741476600,
"threadId": "thread_abc123",
"role": "assistant",
"content": [
{
"type": "text",
"text": "I have retrieved the billing information for you."
}
],
"toolCalls": [
{
"id": "call_123",
"type": "function",
"function": {
"name": "get_billing_info",
"arguments": "{\\"user_id\\":\\"user_abc123\\"}"
},
"result": "{\\"status\\":\\"success\\",\\"billing_amount\\":120.50}"
}
],
"iterations": [
{
"type": "reasoning",
"content": "The user is asking for billing information. I will use the get_billing_info tool."
}
],
"metadata": {}
}
],
"firstId": "msg_abc123",
"lastId": "msg_xyz789",
"hasMore": false
}