SPB Git

Repository Public

update.md 9.7 KB 437 lines markdown

1---2title: Update Environment3url: https://platform.claude.com/docs/en/api/beta/environments/update4---56# Update Environment78**POST** `/v1/environments/{environment_id}`910Update an existing environment's configuration.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## Body parameters121122- `config: optional BetaCloudConfigParams or BetaSelfHostedConfigParams or null`123124  Updated environment configuration125126  - `BetaCloudConfigParams object`127128    Request params for `cloud` environment configuration.129130    Fields default to null; on update, omitted fields preserve the131    existing value.132133    - `type: "cloud"`134135      Environment type136137    - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams or null`138139      Network configuration policy. Omit on update to preserve the existing value.140141      - `BetaUnrestrictedNetwork object`142143        Unrestricted network access.144145        - `type: "unrestricted"`146147          Network policy type148149      - `BetaLimitedNetworkParams object`150151        Limited network request params.152153        Fields default to null; on update, omitted fields preserve the154        existing value.155156        - `type: "limited"`157158          Network policy type159160        - `allow_mcp_servers: optional boolean or null`161162          Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.163164        - `allow_package_managers: optional boolean or null`165166          Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false` on creation. Must be `true` when `packages` are specified.167168        - `allowed_hosts: optional array of string or null`169170          Specifies domains the container can reach.171172    - `packages: optional BetaPackagesParams or null`173174      Specify packages (and optionally their versions) available in this environment.175176      When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest.177178      Under `limited` networking, requires `networking.allow_package_managers` to be `true`.179180      - `type: optional "packages"`181182        Package configuration type183184        default: packages185186      - `apt: optional array of string or null`187188        Ubuntu/Debian packages to install189190      - `cargo: optional array of string or null`191192        Rust packages to install193194      - `gem: optional array of string or null`195196        Ruby packages to install197198      - `go: optional array of string or null`199200        Go packages to install201202      - `npm: optional array of string or null`203204        Node.js packages to install205206      - `pip: optional array of string or null`207208        Python packages to install209210  - `BetaSelfHostedConfigParams object`211212    Request params for `self_hosted` environment configuration.213214    - `type: "self_hosted"`215216      Environment type217218- `description: optional string or null`219220  Updated description of the environment. Omit to preserve; null clears to null; an empty string is stored as an empty string.221222  maxLength: 1024223224- `metadata: optional map[string]`225226  User-provided metadata key-value pairs. Set a value to null or empty string to delete the key.227228- `name: optional string or null`229230  Updated name for the environment231232  maxLength: 256, minLength: 1233234- `scope: optional "organization" or "account" or null`235236  The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only.237238  - `"organization"`239240  - `"account"`241242## Returns243244- `BetaEnvironment object`245246  Unified Environment resource for both cloud and self-hosted environments.247248  - `type: "environment"`249250    The type of object (always 'environment')251252    default: environment253254  - `id: string`255256    Environment identifier (e.g., 'env_...')257258  - `archived_at: string or null`259260    RFC 3339 timestamp when environment was archived, or null if not archived261262  - `config: BetaCloudConfig or BetaSelfHostedConfig`263264    Environment configuration (either Anthropic Cloud or self-hosted)265266    - `BetaCloudConfig object`267268      `cloud` environment configuration.269270      - `type: "cloud"`271272        Environment type273274      - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork`275276        Network configuration policy.277278        - `BetaUnrestrictedNetwork object`279280          Unrestricted network access.281282          - `type: "unrestricted"`283284            Network policy type285286        - `BetaLimitedNetwork object`287288          Limited network access.289290          - `type: "limited"`291292            Network policy type293294          - `allow_mcp_servers: boolean`295296            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.297298          - `allow_package_managers: boolean`299300            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.301302          - `allowed_hosts: array of string`303304            Specifies domains the container can reach.305306      - `packages: BetaPackages`307308        Package manager configuration.309310        - `type: optional "packages"`311312          Package configuration type313314          default: packages315316        - `apt: array of string`317318          Ubuntu/Debian packages to install319320        - `cargo: array of string`321322          Rust packages to install323324        - `gem: array of string`325326          Ruby packages to install327328        - `go: array of string`329330          Go packages to install331332        - `npm: array of string`333334          Node.js packages to install335336        - `pip: array of string`337338          Python packages to install339340    - `BetaSelfHostedConfig object`341342      Configuration for self-hosted environments.343344      - `type: "self_hosted"`345346        Environment type347348  - `created_at: string`349350    RFC 3339 timestamp when environment was created351352  - `description: string or null`353354    User-provided description for the environment; null when unset355356  - `metadata: map[string]`357358    User-provided metadata key-value pairs359360  - `name: string`361362    Human-readable name for the environment363364  - `updated_at: string`365366    RFC 3339 timestamp when environment was last updated367368  - `scope: optional "organization" or "account"`369370    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.371372    - `"organization"`373374    - `"account"`375376## Example377378```bash379curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \380    -H 'Content-Type: application/json' \381    -H 'anthropic-version: 2023-06-01' \382    -H 'anthropic-beta: managed-agents-2026-04-01' \383    -H "X-Api-Key: $ANTHROPIC_API_KEY" \384    -d '{385          "description": "Python environment with data-analysis packages."386        }'387```388389### Response (200)390391```json392{393  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",394  "archived_at": null,395  "config": {396    "networking": {397      "allow_mcp_servers": false,398      "allow_package_managers": true,399      "allowed_hosts": [400        "api.example.com"401      ],402      "type": "limited"403    },404    "packages": {405      "apt": [406        "string"407      ],408      "cargo": [409        "string"410      ],411      "gem": [412        "string"413      ],414      "go": [415        "string"416      ],417      "npm": [418        "string"419      ],420      "pip": [421        "pandas",422        "numpy"423      ],424      "type": "packages"425    },426    "type": "cloud"427  },428  "created_at": "2026-03-15T10:00:00Z",429  "description": "Python environment with data-analysis packages.",430  "metadata": {},431  "name": "python-data-analysis",432  "type": "environment",433  "updated_at": "2026-03-15T10:00:00Z",434  "scope": "organization"435}436```437
Files main
Menu

Theme