Archive Environment

Updated at:

Soft archive: the environment is retained but excluded from list results by default; it can still be retrieved. Sessions already bound to this environment continue to work.

Prerequisites

Endpoint and authentication are configured. See Overview and authentication.

Endpoint

POST /environments/{environment_id}/archive

Semantics

Soft archive: the response returns the full environment object with the archived_at field populated with the archive time. Once archived, the environment is excluded from list results by default (unless include_archived=true), but can still be retrieved via GET. Sessions already bound to this environment continue to work.

Request example

curl -X POST "$AGENTSTUDIO_URL/environments/env_xxx/archive" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"
client.environments.archive("env_xxx")
client.environments().archive("env_xxx");

Response example

{
  "id": "env_xxx",
  "type": "environment",
  "name": "data-sandbox",
  "description": "数据分析沙箱",
  "config": {
    "type": "cloud",
    "packages": {"apt": ["ffmpeg"], "pip": ["pandas", "numpy", "matplotlib"]},
    "networking": {"type": "unrestricted"}
  },
  "metadata": {"team": "infra"},
  "scope": "organization",
  "archived_at": "2026-06-16T13:47:18+08:00",
  "created_at": "2026-06-16T12:45:34+08:00",
  "updated_at": "2026-06-16T13:47:18+08:00",
  "requestId": "xxx"
}

The response is an Environment object with the archived_at field populated with the archive time. Fields are as follows:

Response fields

FieldTypeDescription
idstringEnvironment ID
typestringFixed value environment
name / description / scope / config / metadatastring / objectBasic environment attributes and full runtime configuration
archived_atstringArchive time, ISO 8601; this field is always non-null in the response from the archive endpoint
created_at / updated_atstringCreation / last update time
requestIdstringUnique identifier for this request