v1

latestOpenAPI 3.1.02026-08-04151221521.2 KB
Messages v2

List Messages (v2 - UIMessage format)

List messages for a task in Vercel AI SDK UIMessage format.

This endpoint returns messages transformed from raw SDK events into
a normalized UIMessage format suitable for frontend consumption.

Features:
- Tool merging: tool_use and tool_result are combined into single tool parts
- Complete-units pagination: Never splits tool request/result pairs across pages
- Runtime transformation: Raw SDK messages are transformed on-demand

Args:
    task_id: The task ID to filter messages by
    limit: Maximum number of complete messages to return (default: 50)
    cursor: Opaque cursor string for pagination
    direction: Pagination direction - "older" (default) or "newer"
    parent_tool_use_id: Filter messages by parent tool use ID (for subagent context)

Returns:
    ListMessagesV2Response with UIMessages and pagination info
get/v2/messages

Query parameters

limitinteger
cursorstring nullable
direction'older' | 'newer'
parent_tool_use_idstring nullable
task_idstring required

The task ID

The task ID

Response

Successful Response

hasMoreboolean

Whether there are more messages to fetch

nextCursorstring nullable

Cursor for fetching the next page

Example response

{
  "data": [
    {
      "createdAt": "2024-01-01T00:00:00Z",
      "id": "msg_01ABC",
      "parts": [
        {
          "text": "Hello, how can I help?",
          "type": "text"
        }
      ],
      "role": "assistant"
    }
  ]
}