Skip to content
Kapten
Esc
↑↓navigate↵open⌘Jpreview

Update an environment variable

Updates a variable’s key, value or type.

PATCH/project/{project_id}/environment/{environment_id}/variable/{variable_id}
Authorization
AuthorizationBearer token (JWT) · headerrequired

JWT token passed in the Authorization header using the Bearer <token> format.

Path parameters
project_iduuidrequired

The unique identifier for the project

environment_iduuidrequired

The unique identifier of the environment

variable_iduuidrequired

The unique identifier for the variable

Request body
requiredapplication/json
keystring

Updated variable key.

valuestring

Updated variable value.

var_typevariable_type

Variable value type

Allowed:key_valuefile
Responses
200

Variable updated successfully

iduuidrequired

A universally unique identifier (UUID) string

organization_iduuidrequired

A universally unique identifier (UUID) string

project_iduuidrequired

A universally unique identifier (UUID) string

environment_iduuid | null
Show properties
Any of:
uuid
string<uuid>
null
null
visibilityvariable_visibilityrequired

Variable scope visibility

Allowed:projectenvironmentcomponent
var_typevariable_typerequired

Variable value type

Allowed:key_valuefile
keystringrequired

Variable key identifier.

is_secretbooleanrequired

Indicates whether the value is stored in Vault.

managedbooleanrequired

Indicates whether the variable is managed by the engine and cannot be updated or deleted through the API.

valuestring | null

Variable value. Null for secret variables.

file_pathstring | null

Absolute file path for file variables.

component_kindcomponent_kind | null
Show properties
Any of:
component_kind
string
null
null
component_iduuid | null
Show properties
Any of:
uuid
string<uuid>
null
null
created_atstring<date-time>required

The timestamp when the variable was created.

updated_atstring<date-time>required

The timestamp when the variable was last updated.

default

Error

codeinteger<int32>required
messagestringrequired
reasonstring

Optional stable machine-readable reason for programmatic error handling

Request
curl -X PATCH 'https://api.kapten.io/project/497f6eca-6276-4993-bfeb-53cbbbba6f08/environment/497f6eca-6276-4993-bfeb-53cbbbba6f08/variable/497f6eca-6276-4993-bfeb-53cbbbba6f08' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "key": "string",
  "value": "string",
  "var_type": "key_value"
}'
Response
{
  "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"
}

Was this page helpful?