Skip to content

Archive Session

POST/v1/sessions/{session_id}/archive

Archive a session. Archived sessions cannot receive new events but their event history remains accessible for auditing and debugging.

Path Parameters

ParameterTypeRequiredDescription
session_idstringThe session ID (sess_...)

Request Examples

python
from anthropic import Anthropic

client = Anthropic(
    api_key="sk-sb-YOUR_KEY",
    base_url="https://api.sandbase.ai"
)

session = client.beta.sessions.archive(
    session_id="sess_01abc..."
)
print(session.archived_at)  # "2026-05-29T10:05:00Z"
bash
curl -X POST https://api.sandbase.ai/v1/sessions/sess_01abc.../archive \
  -H "Authorization: Bearer sk-sb-YOUR_KEY"

Response

Returns the updated Session object with archived_at set.

json
{
  "id": "sess_01abc...",
  "type": "session",
  "status": "idle",
  "title": "Research task",
  "agent_id": "agent_01HqR2k7...",
  "agent_version": 1,
  "environment_id": "env_01abc...",
  "usage": { "input_tokens": 12500, "output_tokens": 4200 },
  "metadata": {},
  "archived_at": "2026-05-29T10:05:00Z",
  "created_at": "2026-05-29T10:00:00Z",
  "updated_at": "2026-05-29T10:05:00Z"
}

Errors

StatusTypeDescription
401authentication_errorInvalid or missing API key
404not_foundSession not found