---
search:
  tags:
    - Environment variables
    - PATCH
seo:
  description: >-
    Updates a variable's key,… Reference for the PATCH
    /project/{project_id}/environment/{environment_id}/variable/{variable_id}
    endpoint in the Platform API.
sidebar:
  label: Update an environment variable
  badge: PATCH
title: Update an environment variable
type: openapi-operation
---
Updates a variable's key, value or type.

`PATCH /project/{project_id}/environment/{environment_id}/variable/{variable_id}`

**Request body** (`application/json`, required)

- `key` (string) — Updated variable key.
- `value` (string) — Updated variable value.
- `var_type` (variable_type) — Variable value type

Request body example:

```json
{
  "key": "string",
  "value": "string",
  "var_type": "key_value"
}
```

**Responses**

- `200` — Variable updated successfully
- `default` — Error

Response example, 200:

```json
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "environment_id": "40ef0e48-a11f-4963-a229-e396c9f7e7c4",
  "visibility": "project",
  "var_type": "key_value",
  "key": "string",
  "is_secret": true,
  "managed": true,
  "value": "string",
  "file_path": "string",
  "component_kind": "Kjob",
  "component_id": "41afafe5-2a48-424a-baef-34c2ad44ef7b",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
```
