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
PATCHto add or update keysPUTto replace the environment map with a new desired state
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.
