> 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 by name

> Update the \`value\` of an existing global variable.\
> \
> \*\*\`checksum\` header is required\*\* — must match the server's current checksum for the variable. Obtain it from the Create response or \`GET /dev/variable/{name}\` → \`data.checksum\`. If it does not match, the update is rejected.\
> \
> Only \`value\` can be updated through this endpoint. To change \`dataType\`, \`isSecret\`, or \`canReset\`, delete and recreate the variable.\
> \
> \*\*On success:\*\* response \`data\` includes the updated variable with a new \`checksum\` — store it for any subsequent update or delete.\
> \
> \*\*Canonical request body:\*\* \`Update/update\_variable.json\`

```json
{"openapi":"3.0.3","info":{"title":"Nected Global Variable API","version":"1.0"},"tags":[{"name":"GlobalVariable","description":"Create, read, update, and delete global variables."}],"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. Only `value` can be changed.","required":["value"],"properties":{"value":{"description":"New value — must match the variable's existing `dataType`"}}},"VariableResponse":{"type":"object","description":"Standard response wrapper for single-variable operations (create, get-by-name, update)","properties":{"data":{"$ref":"#/components/schemas/GlobalVariable"},"code":{"type":"string"},"message":{"type":"string"}}},"GlobalVariable":{"type":"object","description":"A global variable object as returned by get and list endpoints","properties":{"name":{"type":"string","description":"Unique variable name within the workspace"},"dataType":{"type":"string","description":"Data type — one of `string`, `numeric`, `boolean`, `json`","enum":["string","numeric","boolean","json"]},"value":{"description":"Variable value. Masked as `***` in responses when `isSecret` is true."},"isSecret":{"type":"boolean","description":"When true, value is masked in all get/list responses"},"canReset":{"type":"boolean","description":"When true, the variable can be reset to its original value via the UI"},"checksum":{"type":"string","description":"Current checksum — required for update and delete operations"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"ErrorResponse":{"type":"object","description":"Error response wrapper","properties":{"code":{"type":"string"},"message":{"type":"string","description":"Human-readable error description"},"data":{"nullable":true}}}}},"paths":{"/dev/variable/{name}":{"patch":{"operationId":"updateGlobalVariableByName","tags":["GlobalVariable"],"summary":"Update global variable by name","description":"Update the `value` of an existing global variable.\n\n**`checksum` header is required** — must match the server's current checksum for the variable. Obtain it from the Create response or `GET /dev/variable/{name}` → `data.checksum`. If it does not match, the update is rejected.\n\nOnly `value` can be updated through this endpoint. To change `dataType`, `isSecret`, or `canReset`, delete and recreate the variable.\n\n**On success:** response `data` includes the updated variable with a new `checksum` — store it for any subsequent update or delete.\n\n**Canonical request body:** `Update/update_variable.json`","parameters":[{"name":"Nected-Branch","in":"header","required":false,"description":"Branch name (optional)","schema":{"type":"string"}},{"name":"checksum","in":"header","required":true,"description":"Current checksum of the variable — from Create or Get response","schema":{"type":"string"}},{"name":"name","in":"path","required":true,"description":"The variable name","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/VariableResponse"}}}},"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.
