Skip to content

Archive Environment

POST/v1/environments/{environment_id}/archive

Archive an environment. Archived environments cannot be used to create new sessions, but existing sessions continue running. Use Delete for permanent removal.

Path Parameters

ParameterTypeRequiredDescription
environment_idstringThe environment ID (env_...)

Request Examples

python
from anthropic import Anthropic

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

env = client.beta.environments.archive(
    environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW"
)
print(env.archived_at)
bash
curl -X POST https://api.sandbase.ai/v1/environments/env_011CZkZ9X2dpNyB7HsEFoRfW/archive \
  -H "Authorization: Bearer sk-sb-YOUR_KEY"

Response

Returns the Environment object with archived_at set.

json
{
  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "type": "environment",
  "name": "python-data-analysis",
  "description": "Python environment with data-analysis packages.",
  "config": {
    "type": "cloud",
    "networking": { "type": "unrestricted" },
    "packages": {
      "type": "packages",
      "apt": [], "cargo": [], "gem": [], "go": [], "npm": [],
      "pip": ["pandas", "numpy"]
    }
  },
  "metadata": {},
  "archived_at": "2026-05-29T12:00:00Z",
  "created_at": "2026-05-29T10:00:00Z",
  "updated_at": "2026-05-29T12:00:00Z"
}

Errors

StatusTypeDescription
401authentication_errorInvalid or missing API key
404not_foundEnvironment not found