---
title: "Get a session"
method: GET
path: "/v1/agents/{agent_id}/sessions/{session_id}"
tags: ["Agents"]
---

# Get a session

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

## Request

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

Get a session and its active run.

## Path parameters

- `agent_id` string, required
- `session_id` string, required

## Response `200`

Successful response.

- object
  - `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

## 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)
