Skip to content

Update Environment ​

POST/v1/environments/{environment_id}

Update an environment. Omitted fields preserve their existing values.

Path Parameters ​

ParameterTypeRequiredDescription
environment_idstring✅The environment ID (env_...)

Request Parameters ​

ParameterTypeRequiredDescription
namestring❌Updated name. Omit to preserve.
descriptionstring❌Updated description. Omit to preserve.
configobject❌Updated configuration. Omitted nested fields preserve their existing values.
metadataobject❌Metadata patch. Set a key to null or empty string to delete it. Omit to preserve.

Field preservation

Within config, omitted fields preserve the existing value. For example, sending only networking leaves packages unchanged. To clear a package list, send an empty array for that manager.

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.update(
    environment_id="env_011CZkZ9X2dpNyB7HsEFoRfW",
    config={
        "type": "cloud",
        "packages": { "type": "packages", "pip": ["pandas", "numpy", "scikit-learn"] }
    }
)
print(env.updated_at)
bash
curl -X POST https://api.sandbase.ai/v1/environments/env_011CZkZ9X2dpNyB7HsEFoRfW \
  -H "Authorization: Bearer sk-sb-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "type": "cloud",
      "packages": { "type": "packages", "pip": ["pandas", "numpy", "scikit-learn"] }
    }
  }'

Response ​

Returns the updated Environment object.

json
{
  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
  "type": "environment",
  "name": "python-data-analysis",
  "description": "Python environment with data-analysis packages.",
  "config": {
    "type": "cloud",
    "networking": {
      "type": "limited",
      "allowed_hosts": ["api.example.com"],
      "allow_mcp_servers": false,
      "allow_package_managers": true
    },
    "packages": {
      "type": "packages",
      "apt": [], "cargo": [], "gem": [], "go": [], "npm": [],
      "pip": ["pandas", "numpy", "scikit-learn"]
    }
  },
  "metadata": {},
  "archived_at": null,
  "created_at": "2026-05-29T10:00:00Z",
  "updated_at": "2026-05-29T11:00:00Z"
}

Errors ​

StatusTypeDescription
400invalid_requestInvalid config or field values
401authentication_errorInvalid or missing API key
404not_foundEnvironment not found