# List Sessions

Source: https://agenta.ai/docs/reference/api/query-sessions-tracing

`POST /tracing/sessions/query`

Base URL: `https://us.cloud.agenta.ai/api` (US cloud), `https://eu.cloud.agenta.ai/api` (EU cloud) or `$AGENTA_HOST/api` (self-hosted). Authentication: `Authorization: ApiKey YOUR_API_KEY`.

:::caution[deprecated]

This endpoint has been deprecated and may be replaced or removed in future versions of the API.

:::

List distinct session IDs from span attributes.

Returns the distinct values of `ag.session.id` across spans in the
current project, in a windowed, cursor-paginated form. Use this to
drive a session-picker UI before drilling into the spans of each
session.

The `realtime` flag controls the cursor field:

- `false` or unset — paginate by a stable `first_active` cursor
  (safe to iterate under heavy write load).
- `true` — paginate by `last_active`, reflecting ongoing activity
  but less stable between pages.

The response includes a `windowing` cursor; pass it as `windowing.next`
on the next call to continue.

## Request body schema

Content type: `application/json` (required)

- `realtime` (boolean, nullable): When `true`, paginate by `last_active` (reflects ongoing activity but can shift between pages). When `false` or unset, paginate by the stable `first_active` cursor.
- `windowing` (object, nullable): Cursor pagination and time range. Pass the returned `windowing.next` on subsequent calls to continue iteration.
  - `newest` (string (date-time), nullable)
  - `oldest` (string (date-time), nullable)
  - `next` (string (uuid), nullable)
  - `limit` (integer, nullable)
  - `order` (string, one of: "ascending", "descending", nullable)
  - `interval` (integer, nullable)
  - `rate` (number, nullable)

## Response schemas

### 200: Successful Response

- `count` (integer): Number of session IDs in this page. Default: `0`.
- `session_ids` (array of string): Distinct values of `ag.session.id` in this page. Default: `[]`.
- `windowing` (object, nullable): Cursor for the next page. Pass verbatim as `windowing.next`.
  - `newest` (string (date-time), nullable)
  - `oldest` (string (date-time), nullable)
  - `next` (string (uuid), nullable)
  - `limit` (integer, nullable)
  - `order` (string, one of: "ascending", "descending", nullable)
  - `interval` (integer, nullable)
  - `rate` (number, nullable)

### 422: Validation Error

- `detail` (array of object)
  - `loc` (array of string | integer, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (Context)
