---
title: "List sessions"
method: GET
path: "/v1/agents/{agent_id}/sessions"
tags: ["Agents"]
---

# List sessions

`GET /v1/agents/{agent_id}/sessions`

## Request

- Base URL: `https://api.dexto.ai`
- URL: `https://api.dexto.ai/v1/agents/{agent_id}/sessions`
- Auth: HTTP bearer

List an agent's sessions, newest first, optionally for one end user.

## Path parameters

- `agent_id` string, required

## Query parameters

- `limit` integer
- `after` string
- `user` string

## Response `200`

Successful response.

- object
  - `data` object[], required
    - `active_run` object, nullable, required
      - `stop_reason` 'completed' | 'cancelled' | 'spend_limit_reached' | 'insufficient_credits' | 'max_steps' | 'error', nullable, required: Why the run stopped, beside its status: completed, cancelled, a reached spend limit, no credits left, the step limit, or any other failure (error).
      - `usage` object, required
        - `credits` number, required: Credits charged so far for the run's model calls, searches, fetches, Function calls and media: every Cloud charge recorded with its run id. Sandbox compute and file storage are charged to the sandbox and the project, not the run. Charges settle as work finishes, so a later read can be higher.
        - `input_tokens` integer, required: Model input tokens of the run so far, cached reads and writes included.
        - `output_tokens` integer, required: Model output tokens of the run so far.
      - `id` string, uuid, required
      - `status` 'queued' | 'running' | 'waiting_approval' | 'completed' | 'failed' | 'cancelled', required
    - `agent_id` string, uuid, required
    - `created_at` string, date-time, required
    - `expires_at` string, date-time, nullable, required: When the session is deleted under its Cloud project's session retention, counted from its last message or run; null when it is kept until you delete it.
    - `id` string, uuid, required
    - `metadata` object, required
    - `object` 'agent_session', required
    - `user` string, required
    - `version` integer, required
  - `has_more` boolean, required
  - `object` 'list', required
  - `next_after` string, nullable, required: An opaque cursor: pass it as `after` to read the next page. Null when there are no more.

## Other responses

- `400`: Invalid JSON or request fields.
- `401`: Missing or invalid API key.
- `402`: The account has insufficient credits.
- `403`: The account cannot perform this operation.
- `404`: The requested resource was not found.
- `409`: The request conflicts with existing resource state.
- `429`: The account exceeded this operation's request rate.
- `500`: Unexpected Dexto failure.
- `502`: The upstream model provider failed.
- `503`: A required Dexto service is temporarily unavailable.

---

[API](https://skmtc.dev/dexto/apis/dexto-api.md) - [All operations](https://skmtc.dev/dexto/apis/dexto-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dexto/apis/dexto-api/revisions/47eb880cffa5?raw)
