---
title: "Update environment variable"
method: PUT
path: "/v2/actors/{actorId}/versions/{versionNumber}/env-vars/{envVarName}"
tags: ["Actors/Actor versions"]
---

# Update environment variable

`PUT /v2/actors/{actorId}/versions/{versionNumber}/env-vars/{envVarName}`

Updates Actor environment variable using values specified by a [EnvVar
object](#/reference/actors/environment-variable-object)
passed as JSON in the POST payload.
If the object does not define a specific property, its value will not be
updated.

The request needs to specify the `Content-Type: application/json` HTTP
header!

When providing your API authentication token, we recommend using the
request's `Authorization` header, rather than the URL. ([More
info](#/introduction/authentication)).

The response is the [EnvVar object](#/reference/actors/environment-variable-object) as returned by the
[Get environment variable](#/reference/actors/environment-variable-object/get-environment-variable)
endpoint.

## Path parameters

- `actorId` string, required
- `versionNumber` string, required
- `envVarName` string, required

## Request body

- EnvVarRequest
  - `name` string, required — The name of the environment variable.
  - `value` string, required — The value of the environment variable. If `isSecret` is `true`, this value isn't returned by the API.
  - `isSecret` boolean, nullable — Whether the environment variable is encrypted. Secret values aren't returned by the API.

## Response `200`

- EnvVarResponse
  - `data` EnvVar, required
    - `name` string, required — The name of the environment variable.
    - `value` string — The value of the environment variable. If `isSecret` is `true`, this value isn't returned by the API.
    - `isSecret` boolean, nullable — Whether the environment variable is encrypted. Secret values aren't returned by the API.

## Other responses

- `400` — Bad request - invalid input parameters or request body.
- `401` — Unauthorized - authentication required or invalid token.
- `403` — Forbidden - insufficient permissions to perform this action.
- `404` — Not found - the requested resource does not exist.
- `405` — Method not allowed.
- `413` — Payload too large - the request body exceeds the size limit.
- `415` — Unsupported media type - the Content-Encoding of the request is not supported.
- `429` — Too many requests - rate limit exceeded.

---

[API](https://skmtc.net/apify/apis/apify-api.md) · [All operations](https://skmtc.net/apify/apis/apify-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/apify/apify-api/versions/01a71794279b/schema)
