Skip to content
Last updated

Retrieve all messages from a specific thread with pagination support.

GEThttps://api.aitronos.com/v1/threads/{thread_id}/messages

Retrieve all messages from a specific thread with pagination support. Returns messages in chronological order with full content and metadata.

Assistant Message Enhancements

For messages where role is assistant, the response may include tool_calls and iterations arrays, providing detailed insight into the model's execution process.

  • tool_calls: 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.

Path Parameters

thread_id string required

The unique identifier of the thread to retrieve messages from.

Query Parameters

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.

output_mode string optional · Defaults to text

Response format mode. Controls how message content is formatted in the response. Available values:

  • text - Rich text with markdown formatting (default)
  • plain - Plain text with all markdown formatting stripped
  • blocks or structured - Typed blocks format with tool calls, results, and text blocks
Bash
curl "https://api.aitronos.com/v1/threads/thread_abc123/messages" \
  -H "X-API-Key: $FREDDY_API_KEY"

Response:

{
  "object": "list",
  "data": [
    {
      "id": "msg_123",
      "created_at": "2025-11-17T10:00:00Z",
      "thread_id": "thread_abc123",
      "role": "user",
      "content": "Hello, world!",
      "attachments": [],
      "metadata": {}
    },
    {
      "id": "msg_456",
      "created_at": "2025-11-17T10:01:00Z",
      "thread_id": "thread_abc123",
      "role": "assistant",
      "content": "Hello! How can I help you today?",
      "attachments": [],
      "metadata": {},
      "tool_calls": [],
      "iterations": []
    }
  ],
  "first_id": "msg_123",
  "last_id": "msg_456",
  "has_more": false
}