Repository Public
1---2title: Archive Environment3url: https://platform.claude.com/docs/en/api/beta/environments/archive4---56# Archive Environment78**POST** `/v1/environments/{environment_id}/archive`910Archive an environment by ID. Archived environments cannot be used to create new sessions.1112## Path parameters1314- `environment_id: string`1516## Headers1718- `"anthropic-beta": optional array of AnthropicBeta`1920 Optional header to specify the beta version(s) you want to use.2122 - `string`2324 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`2526 - `"message-batches-2024-09-24"`2728 - `"prompt-caching-2024-07-31"`2930 - `"computer-use-2024-10-22"`3132 - `"computer-use-2025-01-24"`3334 - `"pdfs-2024-09-25"`3536 - `"token-counting-2024-11-01"`3738 - `"token-efficient-tools-2025-02-19"`3940 - `"output-128k-2025-02-19"`4142 - `"files-api-2025-04-14"`4344 - `"mcp-client-2025-04-04"`4546 - `"mcp-client-2025-11-20"`4748 - `"dev-full-thinking-2025-05-14"`4950 - `"interleaved-thinking-2025-05-14"`5152 - `"code-execution-2025-05-22"`5354 - `"extended-cache-ttl-2025-04-11"`5556 - `"context-1m-2025-08-07"`5758 - `"context-management-2025-06-27"`5960 - `"model-context-window-exceeded-2025-08-26"`6162 - `"skills-2025-10-02"`6364 - `"fast-mode-2026-02-01"`6566 - `"output-300k-2026-03-24"`6768 - `"user-profiles-2026-03-24"`6970 - `"user-profiles-2026-08-18"`7172 - `"user-profiles-2026-09-04"`7374 - `"advisor-tool-2026-03-01"`7576 - `"managed-agents-2026-04-01"`7778 - `"cache-diagnosis-2026-04-07"`7980 - `"dreaming-2026-04-21"`8182 - `"thinking-token-count-2026-05-13"`8384 - `"server-side-fallback-2026-06-01"`8586 - `"server-side-fallback-2026-07-01"`8788 - `"fallback-credit-2026-06-01"`8990 - `"fallback-credit-2026-07-01"`9192 - `"agent-memory-2026-07-22"`9394 - `"mid-conversation-tool-changes-2026-07-01"`9596 - `"compact-2026-01-12"`9798 - `"computer-use-2025-11-24"`99100 - `"mcp-tunnels-2026-06-22"`101102 - `"structured-outputs-2025-11-13"`103104 - `"task-budgets-2026-03-13"`105106 - `"thinking-display-updates-2026-08-18"`107108 - `"ce-user-management-2026-07-13"`109110 - `"mid-conversation-output-config-2026-07-01"`111112 - `"thinking-binding-controls-2026-08-01"`113114 - `"mid-conversation-system-clear-at-2026-08-21"`115116 - `"compact-2026-09-04"`117118- `"anthropic-workspace-id": optional string`119120## Returns121122- `BetaEnvironment object`123124 Unified Environment resource for both cloud and self-hosted environments.125126 - `type: "environment"`127128 The type of object (always 'environment')129130 default: environment131132 - `id: string`133134 Environment identifier (e.g., 'env_...')135136 - `archived_at: string or null`137138 RFC 3339 timestamp when environment was archived, or null if not archived139140 - `config: BetaCloudConfig or BetaSelfHostedConfig`141142 Environment configuration (either Anthropic Cloud or self-hosted)143144 - `BetaCloudConfig object`145146 `cloud` environment configuration.147148 - `type: "cloud"`149150 Environment type151152 - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork`153154 Network configuration policy.155156 - `BetaUnrestrictedNetwork object`157158 Unrestricted network access.159160 - `type: "unrestricted"`161162 Network policy type163164 - `BetaLimitedNetwork object`165166 Limited network access.167168 - `type: "limited"`169170 Network policy type171172 - `allow_mcp_servers: boolean`173174 Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.175176 - `allow_package_managers: boolean`177178 Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.179180 - `allowed_hosts: array of string`181182 Specifies domains the container can reach.183184 - `packages: BetaPackages`185186 Package manager configuration.187188 - `type: optional "packages"`189190 Package configuration type191192 default: packages193194 - `apt: array of string`195196 Ubuntu/Debian packages to install197198 - `cargo: array of string`199200 Rust packages to install201202 - `gem: array of string`203204 Ruby packages to install205206 - `go: array of string`207208 Go packages to install209210 - `npm: array of string`211212 Node.js packages to install213214 - `pip: array of string`215216 Python packages to install217218 - `BetaSelfHostedConfig object`219220 Configuration for self-hosted environments.221222 - `type: "self_hosted"`223224 Environment type225226 - `created_at: string`227228 RFC 3339 timestamp when environment was created229230 - `description: string or null`231232 User-provided description for the environment; null when unset233234 - `metadata: map[string]`235236 User-provided metadata key-value pairs237238 - `name: string`239240 Human-readable name for the environment241242 - `updated_at: string`243244 RFC 3339 timestamp when environment was last updated245246 - `scope: optional "organization" or "account"`247248 The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.249250 - `"organization"`251252 - `"account"`253254## Example255256```bash257curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/archive \258 -X POST \259 -H 'anthropic-version: 2023-06-01' \260 -H 'anthropic-beta: managed-agents-2026-04-01' \261 -H "X-Api-Key: $ANTHROPIC_API_KEY"262```263264### Response (200)265266```json267{268 "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",269 "archived_at": null,270 "config": {271 "networking": {272 "allow_mcp_servers": false,273 "allow_package_managers": true,274 "allowed_hosts": [275 "api.example.com"276 ],277 "type": "limited"278 },279 "packages": {280 "apt": [281 "string"282 ],283 "cargo": [284 "string"285 ],286 "gem": [287 "string"288 ],289 "go": [290 "string"291 ],292 "npm": [293 "string"294 ],295 "pip": [296 "pandas",297 "numpy"298 ],299 "type": "packages"300 },301 "type": "cloud"302 },303 "created_at": "2026-03-15T10:00:00Z",304 "description": "Python environment with data-analysis packages.",305 "metadata": {},306 "name": "python-data-analysis",307 "type": "environment",308 "updated_at": "2026-03-15T10:00:00Z",309 "scope": "organization"310}311```312