---
title: "Set environment variables"
method: POST
path: "/client/services/{id}/env"
tags: ["Apps"]
---

# Set environment variables

`POST /client/services/{id}/env`

## Request

- Base URL: `https://api.roar-ai.com`
- URL: `https://api.roar-ai.com/client/services/{id}/env`
- Auth: HTTP bearer

Upserts one or more variables, and removes others, in ONE change: `{ "vars": { "NAME": "value" }, "remove": ["OLD_NAME"] }` (either may be omitted, not both). Saving restarts the app once, on the version already running, so the change is live within about a minute — send every change together rather than one request each, or the app restarts once per request. `id` is a SERVICE id — take it from `services[].id` on `GET /client/apps/{appId}`, not the app id itself. Requires `apps:deploy`.

Names Roar manages are refused, and the refusal says what your app already has.

A 409 means somebody else was saving at the same moment and NOTHING of yours was written — send the same request again. It is never a partial save.

## Path parameters

- `id` string, uuid, required

## Response `200`

Saved

## Other responses

- `400`: Reserved name, or a value the env file cannot carry
- `403`: Key lacks apps:deploy
- `404`: No such app service
- `409`: A concurrent change won; nothing was saved, retry

---

[API](https://skmtc.dev/roar-ai/apis/roar-ai-api.md) · [All operations](https://skmtc.dev/roar-ai/apis/roar-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/roar-ai/apis/roar-ai-api/revisions/37e4d0d5a7fe?raw)
