Ana içeriğe geç

Update Environment Variable

Endpoint​

PUT /apiops/projects/{projectName}/environmentVariables/{name}/

Authentication​

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request​

Headers​

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/jsonYes

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name (can be "admin" for admin project)
namestringYesCurrent environment variable name

Request Body​

Same structure as Create Environment Variable. See Create Environment Variable for field descriptions.

Important Notes​

  • Path {name} identifies the variable to update; backend always keeps this name (rename is not supported)
  • name in the body should match the path for consistency
  • Description, global, values, and visibility fields can be updated

Response​

Same as Create Environment Variable. See Create Environment Variable for response format.

cURL Example​

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/environmentVariables/API_BASE_URL/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "API_BASE_URL",
"description": "Updated base URL",
"global": false,
"environmentValueList": [
{
"environmentName": "production",
"value": "https://new-api.production.example.com",
"visible": true
}
]
}'

Permissions​

User must have GLOBAL_SETTINGS + MANAGE permission in the project. See Environment Variables API for read vs write permissions.

Notes and Warnings​

  • Name is fixed:

    • Variable name comes from the path parameter {name}
    • APIops does not support renaming via a different body name
  • Variable Must Exist:

    • Variable with the path name must exist (400 if not found)
  • Value semantics — omitting versus clearing:

    • Send values as plain text; every value is encrypted before it is stored, whether or not it is marked Secret
    • Omitting a value (null) KEEPS the stored value. This is how a Secret value survives an update, since read endpoints never return it
    • Sending an empty string ("") CLEARS the value
  • Automatic Deployment:

    • Variable is automatically deployed after update