---
title: "Set environment variable"
method: PUT
path: "/api/v1/functions/{function_id}/env"
tags: ["Functions"]
---

# Set environment variable

`PUT /api/v1/functions/{function_id}/env`

Create or update one variable. Live functions roll the change out as
a new revision with zero downtime. Keys prefixed `PORT`, `K_` or
`RAFF_` are reserved.

## Path parameters

- `function_id` string, required

## Request body

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

## Response `200`

Variable set (response includes the config redeploy when one was started)

## 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)
