---
title: "Set or remove a custom deployment's environment variables"
method: POST
path: "/platform/deployments/custom/{id}/vars"
tags: ["Platform"]
---

# Set or remove a custom deployment's environment variables

`POST /platform/deployments/custom/{id}/vars`

## Request

- Base URL: `https://api.imprezahost.com/v1`
- URL: `https://api.imprezahost.com/v1/platform/deployments/custom/{id}/vars`
- Auth: API key in header `X-API-Key` and API key in header `X-API-Secret`

Edits the deployment's own variables. Send `set` (an object to upsert;
keys are upper-cased) and/or `unset` (a list of names to remove), or
`replace` to declare the whole set at once. At least one of them is
required.

Platform-managed keys are **ignored** in `set` and cannot be `unset` —
the response lists any you passed under `ignored_keys` rather than
failing the call. A value equal to the mask token means "leave this
one alone", so a read-modify-write round trip does not destroy secrets
the read masked.

Each value is one line of valid UTF-8 text, at most 32 KiB, with no
control characters. `$` and ` #` are refused with 400: the app's
environment file is read verbatim, where `$` triggers variable
substitution and ` #` starts a comment. Names starting with
`COMPOSE_` or `DOCKER_` are refused too, because they steer the
container engine itself.

Saving does **not** restart anything: new values reach the container on
the next deploy. Call
`POST /platform/deployments/custom/{id}/redeploy` to apply them now —
that keeps the same domain and port.

## Path parameters

- `id` string, required

## Request body

- object
  - `set` object: Variables to add or update. Keys are upper-cased.
  - `unset` string[]: Variable names to remove.
  - `replace` object: Declare the complete set of your variables, removing any not listed.

## Response `200`

Saved. Redeploy to apply.

- object
  - `success` boolean
  - `data` object
    - `vars` object
    - `managed` object
    - `managed_keys` string[]
    - `note` string
    - `ignored_keys` string[]: Platform-managed keys you passed, which were left unchanged.
  - `meta` Meta
    - `request_id` string
    - `timestamp` string, date-time

## Other responses

- `400`: Neither `replace` nor `set` / `unset` was provided
- `404`: No such custom deployment on this account

---

[API](https://skmtc.dev/imprezahost/apis/impreza-host-public-api.md) · [All operations](https://skmtc.dev/imprezahost/apis/impreza-host-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/imprezahost/apis/impreza-host-public-api/revisions/db86511f604f?raw)
