---
title: "set environment variable"
method: POST
path: "/w/{workspace}/workspaces/set_environment_variable"
tags: ["workspace"]
---

# set environment variable

`POST /w/{workspace}/workspaces/set_environment_variable`

## Path parameters

- `workspace` string, required

## Request body

- object
  - `name` string, required — Environment variable name. New names must be a plain JS identifier (matching ^[A-Za-z_$][A-Za-z0-9_$]*$) since the name is spliced into the NativeTS/Bun worker prologue; otherwise the request is rejected with 400. Existing names can still be updated regardless of shape.
  - `value` string

## Response `200`

status

---

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