> 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nected.ai/nected-docs/management-api/global-variable-api/update-global-variable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
