> For the complete documentation index, see [llms.txt](https://docs.nected.ai/nected-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nected.ai/nected-docs/management-api/global-variable-api/update-global-variable.md).

# Update Global Variable

Update the `value` of an existing global variable by its `name`. Only `value` can be changed — to modify `dataType`, `isSecret`, or `canReset`, delete and recreate the variable.

## Update global variable

> Update the \`value\` of an existing global variable.\
> \
> \*\*\`checksum\` is required\*\* in the request body and must match the server's current checksum for the variable. Get it from the create response or from \*\*Get global variable by id\*\* (\`data.checksum\`). If it doesn't match, the update is rejected.\
> \
> \*\*On success:\*\* \`data.checksum\` is the variable's new checksum — store it for the next update.

```json
{"openapi":"3.0.3","info":{"title":"Nected Global Variable API (Dev V1)","version":"1.0"},"tags":[{"name":"Global Variable API","description":"The Global Variable API lets you list, create, read and update **global variables** in your workspace. Global variables are reusable, named values referenced across rules and workflows, useful for configuration values, feature flags, rate constants and secrets.\n\nAll endpoints follow the generic `/dev/v1/{entity-type}` path, with `entity-type` set to `variable`.\n\n**Supported operations:** list, create, get and update. Delete is not available in the `/dev/v1` API.\n\n**Supported `dataType` values:** `string`, `numeric`, `boolean`, `json`.\n\n**`checksum` and optimistic locking:** updating a variable requires its current `checksum` in the request body. Get it from the create response or from a get response. If it doesn't match the server's current checksum, the update is rejected.\n\n**Secret variables:** when `isSecret` is `true`, the `value` is masked as `***` in all get and list responses."}],"servers":[{"url":"https://api.nected.ai","description":"Production"}],"security":[{"DevAuth":[]}],"components":{"securitySchemes":{"DevAuth":{"type":"apiKey","in":"header","name":"Nected-API-Key","description":"Your Nected API key. Obtain from workspace settings."}},"schemas":{"UpdatePayload":{"type":"object","description":"Request body for updating a global variable.","required":["value","checksum"],"properties":{"value":{"description":"New value — must match the variable's existing `dataType`"},"checksum":{"type":"string","description":"Current checksum of the variable"}}},"UpdateVariableResponse":{"type":"object","description":"Success response for update","properties":{"data":{"type":"object","properties":{"checksum":{"type":"string","description":"New checksum — store it for the next update"}}},"code":{"type":"string"},"message":{"type":"string"}}},"ErrorResponse":{"type":"object","description":"Error response wrapper","properties":{"code":{"type":"string"},"message":{"type":"string","description":"Human-readable error description"},"data":{"type":"object","nullable":true}}}}},"paths":{"/dev/v1/variable/{entity-id}":{"patch":{"operationId":"updateGlobalVariable","tags":["Global Variable API"],"summary":"Update global variable","description":"Update the `value` of an existing global variable.\n\n**`checksum` is required** in the request body and must match the server's current checksum for the variable. Get it from the create response or from **Get global variable by id** (`data.checksum`). If it doesn't match, the update is rejected.\n\n**On success:** `data.checksum` is the variable's new checksum — store it for the next update.","parameters":[{"name":"Nected-Branch","in":"header","required":false,"description":"Branch name (optional)","schema":{"type":"string"}},{"name":"entity-id","in":"path","required":true,"description":"The variable's entity ID (from the create response `data.id`)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePayload"}}}},"responses":{"200":{"description":"OK — variable updated, new `checksum` returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateVariableResponse"}}}},"400":{"description":"Bad Request — checksum mismatch or validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

### Checksum (required)

The `checksum` must be sent as a **request header**. Obtain the current checksum from:

* **Create** response (`data.checksum`), or
* **Get global variable by name** (`data.checksum`) — most reliable.

If the checksum does not match the server's current state, the update is rejected.

On success, the response returns the updated variable with a **new `checksum`** — store it before calling update or delete again.
