> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markifact.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Variable

> Replaces a variable in a Google Tag Manager workspace with a full Variable resource payload

Replaces a variable in a Google Tag Manager workspace with a full Variable resource payload. Workflow: gtm\_get\_variable, edit the payload, gtm\_update\_variable, then version and publish.

|                       |                       |
| --------------------- | --------------------- |
| **App**               | Google Tag Manager    |
| **Operation ID**      | `gtm_update_variable` |
| **Type**              | Action                |
| **Connection**        | `gtm` (required)      |
| **Credits per run**   | 1                     |
| **Agent / MCP tool**  | Yes                   |
| **Requires approval** | Yes (write operation) |

## Inputs

| Field              | Type             | Required | Default | Description                                                                                                                                                                                                                                                                                                                          |
| ------------------ | ---------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `account`          | DynamicAccount   | Yes      | -       | Select the Google Tag Manager account.                                                                                                                                                                                                                                                                                               |
| `container`        | DynamicAccount   | Yes      | -       | Select the container.                                                                                                                                                                                                                                                                                                                |
| `workspace`        | DynamicAccount   | Yes      | -       | Select the workspace.                                                                                                                                                                                                                                                                                                                |
| `variable`         | DynamicAccount   | Yes      | -       | Select the variable to update, or provide its variable ID.                                                                                                                                                                                                                                                                           |
| `variable_payload` | object or string | Yes      | -       | Full replacement Variable resource (object or JSON string) matching the Google Tag Manager API v2 Variable spec; the update replaces the variable entirely, so include every field the variable should keep. Workflow: gtm\_get\_variable -> edit the payload -> gtm\_update\_variable. Read-only fields are stripped automatically. |

## Output

**Type**: `Dict`

Returns the updated variable as provided by the Tag Manager API.
