---
title: "Update an environment variable"
method: PATCH
path: "/projects/{projectId}/environments/{environmentId}/variables/{variableId}"
tags: ["Environment Variables"]
---

# Update an environment variable

`PATCH /projects/{projectId}/environments/{environmentId}/variables/{variableId}`

Update a single user-defined environment variable.
The `value` can be either a string or a JSON
object (default: string), as specified by the `is_json` boolean flag.
Additionally, the inheritability of an environment variable can be
determined through the `is_inheritable` flag (default: true).
See the [Variables](https://docs.upsun.com/anchors/variables/)
section in our documentation for more information.

## Path parameters

- `projectId` string, required
- `environmentId` string, required
- `variableId` string, required

## Request body

- EnvironmentVariablePatch
  - `name` string — Name of the variable
  - `attributes` object — Arbitrary attributes attached to this resource
  - `value` string — Value of the variable
  - `is_json` boolean — The variable is a JSON string
  - `is_sensitive` boolean — The variable is sensitive
  - `visible_build` boolean — The variable is visible during build
  - `visible_runtime` boolean — The variable is visible at runtime
  - `application_scope` string[] — Applications that have access to this variable
  - `is_enabled` boolean — The variable is enabled on this environment
  - `is_inheritable` boolean — The variable is inheritable to child environments

## Response `default`

- AcceptedResponse
  - `status` string, required — The status text of the response
  - `code` integer, required — The status code of the response

---

[API](https://skmtc.net/upsun/apis/upsun-com-rest-api.md) · [All operations](https://skmtc.net/upsun/apis/upsun-com-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/upsun/upsun-com-rest-api/revisions/6cc88fde6435/schema)
