List Events

Updated at:

Queries session event history with pagination. The returned structure matches the SSE frame data. Supports filtering by event type, time window, and sorting.

Prerequisites

A session must already be created. For details, see Create Session. {session_id} is in the format sesn_xxx....

Endpoint

GET/sessions/{session_id}/events

The returned structure matches the SSE frame data. For details on event envelope fields, see the Event envelope section in Subscribe to Event SSE Stream.

Path parameters

session_idstringRequired

Session ID, format sesn_<ULID>

Query parameters

typesstring

Filter by event type; can be repeated. Example: ?types=message&types=tool_approval_request. Use types=error to re-fetch runtime errors

orderstring

Sort direction: asc (ascending) / desc (descending)

Default: asc
created_at[gt] / [gte] / [lt] / [lte]string

Filter by time window, ISO 8601; the four comparison operators can be combined

limitint

Number of items per page, maximum 100

Default: 20
pagestring

Omit on the first request; pass next_page from the previous response for subsequent requests

Response fields

dataarray<object>

Array of event Message objects, sorted by order

data[].objectstring

Always message

data[].idstring

Event ID, prefix msg_ or out_

data[].created_atstring

Event timestamp, ISO 8601

data[].sequence_numberinteger / null

Event sequence number; observed as null

data[].thread_idstring

Thread ID, e.g. thrd_xxx

data[].statusstring

Always completed

data[].rolestring

user / assistant / tool

data[].typestring

Event type, same values as SSE server push events. For details, see Subscribe to Event SSE Stream

data[].contentarray<object>

ContentBlock array, same structure as the send side

data[].is_errorbool

Only on tool output events (tool_call_output / mcp_call_output), written at the Message top level: true means the tool execution failed or was interrupted/rejected; in that case data is still a ToolCallOutput / McpCallOutput containing at least call_id and output

data[].metadataobject

Event additional information (such as thread_id, call_id, etc.)

next_pagestring / null

Cursor for the next page; not returned or null when there is no more data

request_idstring

Unique identifier for this request

Request example

curl "$AGENTSTUDIO_URL/sessions/sesn_xxx/events?order=asc&limit=100" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"
for event in client.sessions.events.list(
    "sesn_xxx",
    limit=100,
    order="asc",
):
    print(event.type, event.created_at)
CursorPage<SessionEvent> events = client.sessions().events().list("sesn_xxx",
    SessionEventListParam.builder()
        .limit(100)
        .order("asc")
        .build());
for (SessionEvent ev : events.getData()) {
    System.out.println("[" + ev.getType() + "] " + ev.getCreatedAt());
}

Response example

Returns data (an array of event Message objects with the same structure as the SSE frame data field; for details, see Subscribe to Event SSE Stream), next_page (cursor for the next page; not returned or null when there is no more data), and request_id. type=error is a separate branch: error details are in the top-level error object of the Message (error.code / error.message), not in content[].data. Message object fields are as follows:

{
  "data": [
    {
      "object": "message",
      "status": "completed",
      "id": "sevt_xxx",
      "created_at": "2026-05-28T16:30:00.000Z",
      "sequence_number": null,
      "type": "session_status",
      "content": [
        {
          "type": "data",
          "data": {
            "session_status": "running"
          }
        }
      ]
    },
    {
      "object": "message",
      "status": "completed",
      "id": "sevt_yyy",
      "created_at": "2026-05-28T16:30:01.000Z",
      "sequence_number": null,
      "type": "message",
      "role": "user",
      "thread_id": "thrd_xxx",
      "content": [
        {
          "type": "text",
          "text": "hello"
        }
      ]
    }
  ],
  "next_page": "cursor_xxx",
  "request_id": "req_xxx"
}