State

Environment Variables

Read, patch, or replace a container's environment map.

Use these routes when you need to inspect or change a running container’s environment map without recreating the container.

Primary routes:

GET   /api/containers/<container_id>/env
PATCH /api/containers/<container_id>/env
PUT   /api/containers/<container_id>/env

Payload:

{
  "environment": {
    "KEY": "value"
  }
}

Use the Right Verb

  • PATCH to add or update keys
  • PUT to replace the environment map with a new desired state

PUT is destructive replacement, not additive merge.

Rule of Thumb

Reach for PATCH first. Use PUT only when you intentionally want the server-side environment to match a brand-new full map.