Skip to main content

Update custom environment variable

Update custom environment variable. PUT /api/openapi/v1/environment-variables/custom/{id}, scope admin.v1.environment-variables.manage.

  • Scope: admin.v1.environment-variables.manage
  • Permission: Manage environment variables
  • Action: manage
  • Endpoint: PUT/api/openapi/v1/environment-variables/custom/{id}
Use Authorization: Bearer \<API_KEY\>. The application must have subject_scope={"mode":"all"}; restricted scopes return 403. Scopes are independently granted. Do not cache responses. Reuses the UI environment-variable service. revision applies to the whole configuration. Read the latest configuration after a successful write; a failed subsequent read does not roll back the write. At most 100 custom variables, identifier keys up to 64 characters and values up to 4096 characters. System keys are reserved. Enabling QWENWORK_USER_SSO_TOKEN requires explicit risk_confirmed=true. Deletion takes revision as a query parameter. The authenticated organization cannot be overridden in the request.

Common request headers

Apply the “Authentication and headers” section in “Configure the QwenWork console through APIs”: Authorization is required and X-Request-Id is optional. See this page for the required scope. Whether Idempotency-Key applies and is required is specified in this page’s request parameters; a tracing identifier does not replace an idempotency key.

Request parameters

Request body: required; Content-Type: application/json.
NameLocationTypeRequiredDescriptionExample
idpathstring · uuidYesid; format="uuid"-
enabledbodybooleanYesenabled-
keybodystringYeskey; minLength=1, maxLength=64, pattern="^[A-Za-z_][A-Za-z0-9_]{0,63}$"-
revisionbodyinteger · int64YesCurrent revision for concurrency control; format="int64", minimum=0-
valuebodystringYesvalue; minLength=1, maxLength=4096-

Response statuses

HTTP statusTriggerResponse structureClient action
200Request succeededSee “Response” on this pageRead the response.
defaultOther authentication, authorization, validation or dependency errorsSee “General error” in “Configure the QwenWork console through APIs”Handle the status and code; verify the result and idempotency requirements before retrying writes.

Response

Content-Type: application/json
NameTypeRequiredDescriptionExample
changedbooleanYeschanged-
revisioninteger · int64YesCurrent revision for concurrency control; format="int64"-

Errors and retries

Existing UI error codes and validation are preserved. 401/403 indicate authentication or authorization failure; 409 requires rereading before retry; 413 indicates an oversized request; 400/422 indicate invalid input; 503 indicates an unavailable dependency. The response and machine contract are authoritative. Retry idempotent creates with the same Idempotency-Key and payload.