---
title: "Set environment variable"
method: PUT
path: "/api/v1/apps/services/{service_id}/env"
tags: ["Raff Apps"]
---

# Set environment variable

`PUT /api/v1/apps/services/{service_id}/env`

Create or update one variable. By default the change rolls out to
running replicas. Set `redeploy: false` to defer it to the next deploy.

## Path parameters

- `service_id` string, required

## Request body

- object
  - `key` string, required
  - `value` string, required
  - `is_secret` boolean
  - `redeploy` boolean

## Response `200`

Variable set

- object
  - `success` boolean
  - `env_vars` AppEnvVar[]
    - `key` string
    - `value` string — Empty for secrets unless fetched via the reveal endpoint
    - `is_secret` boolean
    - `is_system` boolean — Managed by the platform (e.g. bindings) — read-only
  - `deployment_id` string, uuid

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication required

---

[API](https://skmtc.dev/rafftechnologies/apis/raff-api.md) · [All operations](https://skmtc.dev/rafftechnologies/apis/raff-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/rafftechnologies/raff-api/revisions/2f4df56be77c/schema)
