---
title: "PUT /accounts/{account_id}/env/{key}"
method: PUT
path: "/accounts/{account_id}/env/{key}"
tags: ["environmentVariables"]
---

# PUT /accounts/{account_id}/env/{key}

`PUT /accounts/{account_id}/env/{key}`

Updates an existing environment variable and all of its values. Existing values will be replaced by values provided.

## Path parameters

- `account_id` string, required
- `key` string, required

## Query parameters

- `site_id` string

## Request body

- object
  - `key` string — The existing or new name of the key, if you wish to rename it (case-sensitive)
  - `scopes` string[] — The scopes that this environment variable is set to (Pro plans and above)
  - `values` EnvVarValue[]
    - `id` string — The environment variable value's universally unique ID
    - `value` string — The environment variable's unencrypted value
    - `context` 'all' | 'dev' | 'dev-server' | 'branch-deploy' | 'deploy-preview' | 'production' | 'branch' — The deploy context in which this value will be used. `dev` refers to local development when running `netlify dev`.
    - `context_parameter` string — An additional parameter for custom branches. Currently, this is used for specifying a branch name when `context=branch`.
  - `is_secret` boolean — Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret.

## Response `200`

OK

- EnvVar — Environment variable model definition
  - `key` string — The environment variable key, like ALGOLIA_ID (case-sensitive)
  - `scopes` string[] — The scopes that this environment variable is set to
  - `values` EnvVarValue[] — An array of Value objects containing values and metadata
    - `id` string — The environment variable value's universally unique ID
    - `value` string — The environment variable's unencrypted value
    - `context` 'all' | 'dev' | 'dev-server' | 'branch-deploy' | 'deploy-preview' | 'production' | 'branch' — The deploy context in which this value will be used. `dev` refers to local development when running `netlify dev`.
    - `context_parameter` string — An additional parameter for custom branches. Currently, this is used for specifying a branch name when `context=branch`.
  - `is_secret` boolean — Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret.
  - `updated_at` string, date-time — The timestamp of when the value was last updated
  - `updated_by` EnvVarUser
    - `id` string — The user's unique identifier
    - `full_name` string — The user's full name (first and last)
    - `email` string — The user's email address
    - `avatar_url` string — A URL pointing to the user's avatar

## Other responses

- `default` — error

---

[API](https://skmtc.net/netlify/apis/netlify-s-api-documentation.md) · [All operations](https://skmtc.net/netlify/apis/netlify-s-api-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/netlify/netlify-s-api-documentation/revisions/71540d1b5d9d/schema)
