Lists sessions with pagination, sorted by created_at in descending order. Supports filtering by agent, status, and creation time range.
Prerequisites
Endpoint and authentication configuration must be completed. For details, see Overview and authentication.
Endpoint
GET /sessions
Query parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
agent_id | No | string | — | Filter by agent |
statuses[] | No | string | — | Filter by multiple statuses; can be repeated. Example: ?statuses[]=idle&statuses[]=running |
created_at[gte] / created_at[lte] | No | string | — | Creation time range, ISO 8601 |
limit | No | int | 20 | Number of items per page, maximum 100 |
page | No | string | — | Omit on the first request; pass next_page from the previous response for subsequent requests |
Request example
Response example
data (an array of Session objects) and next_page (cursor for the next page). Session object fields are as follows:
Session object fields
| Field | Type | Description |
|---|---|---|
id | string | Session ID, format sesn_<ULID> |
type | string | Fixed as session |
status | string | Session status: idle / running / terminated |
stop_reason | object | null | The reason the session returned to idle. A discriminated union: null (running, or idle and just created) | {"type": "end_turn"} | {"type": "retries_exhausted"} | {"type": "requires_action", "pending_batch_id": "...", "pending_call_ids": [...]}. Only meaningful when status is idle; see Retrieve Session for full details |
agent | object | Agent configuration snapshot, including id/version/name/model/system/tools, etc. |
environment_id | string | The bound environment ID |
title / metadata | string / object | Session title and custom business metadata |
archived_at | string | null | Archive time; null when not archived |
created_at / updated_at | string | Creation/last update time, ISO 8601 |
environment_variables | object | Environment variables injected into the session runtime as string key-value pairs; sandbox code can read them directly by name |