Get Messages
/api/threads/{threadId}/messagesRetrieves all messages in a thread. Messages queued by sendMessage() or
queueMessage() that have not yet been injected into stored history are
included as pending messages with metadata.queued: true.
threadIdstringrequiredThe unique thread identifier (UUID)
limitnumberdefault: 100Maximum number of messages to return
offsetnumberdefault: 0Number of messages to skip from the start of the selection.
orderstringdefault: descdesc selects the newest messages first.
asc selects the oldest messages first.
The response array is chronological in both cases.
depthnumberdefault: 0Maximum message depth to include.
0 includes top-level messages.
idsstringComma-separated message IDs to fetch directly. This mode replaces pagination.
includeWorkblocksbooleandefault: falseSet true to include related workblock messages in ids mode.
includeSilentbooleandefault: falseInclude silent messages (used for lifecycle/status/subagent communication)
messagesarrayrequiredArray of message objects
totalnumberrequiredNumber of messages that match the silent and depth filters before pagination.
In ids mode, this is the number of returned messages.
hasMorebooleanrequiredWhether more messages exist beyond the current page
Message Object
messages[].idstringrequiredUnique message identifier
messages[].rolestringrequiredMessage role: "system", "user", "assistant", or "tool"
messages[].contentstring | nullrequiredMessage content (null for tool calls without text)
messages[].silentbooleanrequiredWhether the message is hidden from default reads and streams.
messages[].reasoning_contentstring | nullPersisted reasoning text returned by the provider.
messages[].reasoning_detailsstring | nullSerialized provider reasoning details.
messages[].tool_statusstring | nullTool result status: success or error.
messages[].namestring | nullDisplay name (e.g., agent label for assistant messages)
messages[].tool_callsstring | nullJSON string of tool calls made by assistant
messages[].tool_call_idstring | nullID linking tool result to its call (for tool role messages)
messages[].created_atnumberrequiredUnix timestamp in microseconds. For a JavaScript date, use new Date(message.created_at / 1000).
messages[].statusstringMessage status: "pending", "completed", or "failed". Queued messages are returned as "pending".
messages[].depthnumberNesting depth for sub-prompt messages (0 for top-level)
messages[].attachmentsarray | nullArray of file attachments. Each attachment object:
id(string): Unique attachment identifiertype(string): Always"file"path(string): File path in thread storage (e.g.,/attachments/123-abc.jpg)name(string): Original filenamemimeType(string): MIME typesize(number): Stored size in byteswidth(number): Image width (images only)height(number): Image height (images only)
messages[].subagent_idstring | nullSubagent reference UUID associated with this message (when present)
messages[].subagent_namestring | nullProjected child agent name from parent registry
messages[].subagent_titlestring | nullProjected child agent title from parent registry
messages[].subagent_statusstring | nullProjected child runtime status (e.g. running, idle, terminated, or custom)
messages[].metadataRecord<string, unknown>Message metadata. The field is absent when the message has no metadata. Runtime lifecycle markers may appear here (for example status_kind). Queued messages include queued: true, queue_status: "queued", and queue_source until they are injected into stored history.