---
title: "Update Environment Variable"
method: PATCH
path: "/v1/convai/environment-variables/{env_var_id}"
tags: ["Agents Platform"]
---

# Update Environment Variable

`PATCH /v1/convai/environment-variables/{env_var_id}`

Replace an environment variable's values. Use null to remove an environment (except production).

## Path parameters

- `env_var_id` string, required

## Headers

- `xi-api-key` string, nullable — Your API key. This is required by most endpoints to access our API programmatically. You can view your xi-api-key using the 'Profile' tab on the website.

## Request body

- UpdateEnvironmentVariableRequest
  - `values` object, required — Values to replace. Set to null to remove an environment (except 'production').

## Response `200`

Successful Response

- EnvironmentVariableResponse
  - `label` string, required
  - `created_at_unix_secs` integer, required
  - `updated_at_unix_secs` integer, required
  - `created_by_user_id` string, nullable
  - `type` 'string' | 'secret' | 'auth_connection', required
  - `id` string, required
  - `workspace_id` string, required
  - `values` union, required
    - object
    - object
    - object

## Other responses

- `400` — Invalid parameters or type mismatch
- `404` — Environment variable not found
- `422` — Validation Error

---

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