---
title: "Unarchive session"
method: POST
path: "/v1/agents/sessions/{session_id}/unarchive"
tags: ["Sessions"]
---

# Unarchive session

`POST /v1/agents/sessions/{session_id}/unarchive`

## Request

- Base URL: `https://api.sandbase.ai`
- URL: `https://api.sandbase.ai/v1/agents/sessions/{session_id}/unarchive`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Unarchive session with compare-and-set on row_version.

## Request body

- SessionRowVersionRequest
  - `row_version` integer, required: The row_version you last read. A stale value returns 409.

## Response `200`

Session

- Session
  - `id` string, required: Session ID (`ses_` prefix).
  - `object` 'agent.session', required
  - `agent` object, required: OpenAI-shaped snapshot of the effective Agent configuration (id, name, model, instructions, multi_agent, reasoning, service_tier, text, tools).
  - `agent_id` string, required
  - `agent_version` integer, required
  - `title` string, required
  - `model` string, required
  - `environment` object, required: Echo of the hosted execution context, kept for OpenAI SDK compatibility. It is not a Sandbox instance and needs no action from clients.
    - `id` string
    - `type` 'openai_hosted'
    - `skills` object[]
  - `metadata` object, required
  - `status` 'idle' | 'in_progress' | 'requires_action' | 'failed', required: Execution status. requires_action is not supported yet and surfaces as a 502 executor_contract_error.
  - `lifecycle_status` 'active' | 'archived', required
  - `sync_status` string, required
  - `execution_status` string, required
  - `failure` SessionFailure, required
    - `code` 'session_creation_rejected' | 'execution_failed' | 'model_authentication_failed' | 'model_rate_limited' | 'model_quota_exceeded' | 'context_limit_exceeded' | 'environment_connection_timeout' | 'runtime_unavailable' | 'model_request_failed' | 'model_configuration_rejected' | 'session_not_ready' | 'session_execution_unavailable' | 'session_configuration_unavailable' | 'session_snapshot_unavailable', required
    - `message` string, required
    - `action` string, required: Suggested next step, such as retry_later, inspect_history, create_new_session, check_model_account, or create_session_with_updated_model_provider.
    - `retryable` boolean
  - `row_version` integer, required
  - `required_actions` unknown[], required
    - unknown
  - `vault_ids` string[], required
  - `usage` object, nullable: Token usage; null until a turn reports usage.
  - `created_at` integer, required
  - `last_active_at` integer, required
  - `updated_at` integer, required
  - `archived_at` integer, nullable, required
  - `source` 'direct' | 'service' | 'schedule' | 'null', nullable
  - `source_id` string, nullable: Service or Schedule ID when source is service or schedule.
  - `source_failure_code` string

## Other responses

- `400`: invalid_request (malformed JSON, unknown fields, failed validation, or an unsupported option)
- `401`: unauthorized: missing, malformed, or conflicting API key headers
- `402`: spending_limit_exceeded: API key spending limit or organization balance exhausted
- `403`: insufficient_scope (scoped key) or org_disabled
- `404`: not_found: the resource does not exist in this organization
- `409`: conflict: stale row_version, lifecycle state, or Idempotency-Key reused with a different body
- `502`: executor_rejected or executor_contract_error from the execution layer
- `503`: authorization_unavailable, admission_unavailable, executor_unavailable, storage_unavailable, or internal_error

---

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