---
title: "POST /v2/vals/{val_id}/environment_variables/"
method: POST
path: "/v2/vals/{val_id}/environment_variables/"
tags: ["vals"]
---

# POST /v2/vals/{val_id}/environment_variables/

`POST /v2/vals/{val_id}/environment_variables/`

Create a new environment variable scoped to this project.

## Path parameters

- `val_id` string, uuid, required

## Request body

- object — Inputs for an environment variable
  - `value` string, required — Value of the environment variable.
  - `description` string, nullable — Optional description of the environment variable. Send null to clear an existing description; omit it to leave the description unchanged.
  - `key` string, required — Name or key of the environment variable, accessible via Deno.env or process.env

## Response `201`

An environment variable

- TEnvironmentVariable — An environment variable
  - `key` string, required — Name or key of the environment variable, accessible via Deno.env or process.env
  - `description` string, nullable, required — Optional description of the environment variable
  - `updatedAt` string, date-time, nullable, required
  - `createdAt` string, date-time, required

## Other responses

- `409` — Key already exists

## Changes

- **2026-08-05** `4d8b6d2e6db3` — 1 breaking, 1 info
  - api path removed without deprecation
  - endpoint added
- **2026-03-11** `dc1b3c9e3b2a` — 1 breaking
  - response property `updatedAt` list-of-types was widened by adding types `null` to media type `application/json` of response `201`
- **2025-10-30** `f039435c5e18` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/val-town/apis/val-town-api/changes/v2/vals/:val_id/environment_variables/post.md)

---

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