CorefinityCorefinityDocs
Open the Control PanelControl Panel
Environment variables · 2 of 4

Update an environment's variable

Creates the variable when the environment does not have it (201), and changes it otherwise (200). Leave value out to keep the stored value, so a rename never needs it; a new variable needs one. The answer carries the mask, never the value.

PUT/api/environments/{environment}/variables/{name}

Path parameters

environmentintegerRequired

The id of a CoreStack Enterprise environment. Not the same number as a site row id. At least 1.

namestringRequired

The variable's name, without the CF_ prefix builds see it with. A new name is letters, digits and underscores, starting with a letter or underscore, at most 64 characters; a variable the environment already has is found by its stored name as it is, whatever the rules were when it was saved.

Body

rename_tostring or null

A new name for the variable, which keeps its value unless value changes it in the same request: letters, digits and underscores, starting with a letter or underscore, at most 64 characters, and not starting with CF_ in any case. Null, or the name it already has, renames nothing.

valuestring or null

Leave out to keep the stored value. An empty string or null clears it. Any other string sets it, exactly as sent: at most 2,048 characters, with no line breaks, control or invisible formatting characters.

Returns

200 The variable after the change.

201 The variable was created.

Fields of the 200 answer
variableobjectRequired
Fields
maskedstringRequired

The mask shown in place of the value. A value of 16 characters or more also shows its last four.

namestringRequired
updated_atstring or nullRequired

When the variable last changed, in UTC. Format: date-time.

Fields of the 201 answer
variableobjectRequired
Fields
maskedstringRequired

The mask shown in place of the value. A value of 16 characters or more also shows its last four.

namestringRequired
updated_atstring or nullRequired

When the variable last changed, in UTC. Format: date-time.

If it is refused

StatusReasonWhat to do
401noneSend a valid token as Authorization: Bearer <token>.
403company_unavailableYour company is unavailable.
403scope_requiredUse a token with the scope named in scope.
403two_factor_requiredTurn on two-factor on your account, then send again.
404noneCheck the id. You see only what your account can reach.
409existsIt already exists. Use the existing one.
422variable_invalidUse letters, digits and underscores, starting with a letter or underscore, without the CF_ prefix (CoreStack adds it).
422variable_reservedCF_DOMAIN is set by CoreStack. Choose another name.
422invalidFix the field named in field; errors says why.
422too_many_variablesThis environment already has the most variables it can hold.
422variable_tool_credentialBuilds see the variable under another name, so the tool it is meant for never reads it. Add the credentials under Deployments, Private registries, instead.
429rate_limitedWait for the seconds in Retry-After.

Reasons are listed by name in Errors and refusals.

The same task elsewhere

curl -X PUT https://manage.corefinity.com/api/environments/1311/variables/API_TOKEN \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "example-value-not-a-real-secret"
  }'
{
  "variable": {
    "masked": "••••••••cret",
    "name": "API_TOKEN",
    "updated_at": "2026-11-09T10:42:07Z"
  }
}
Try it

Try it is off for this endpointIt has not been cleared for the console. Copy the request and run it yourself when you are sure.

Was this helpful?
Open in ClaudeOpen in ChatGPT