> ## 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 Template

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

Replaces a template in a Google Tag Manager workspace with a full resource payload. Custom templates define reusable tag, variable, and client types in a Google Tag Manager container. Version and publish to take changes live.

|                       |                       |
| --------------------- | --------------------- |
| **App**               | Google Tag Manager    |
| **Operation ID**      | `gtm_update_template` |
| **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.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `template`         | DynamicAccount   | Yes      | -       | Select the template to update, or provide its ID.                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `template_payload` | object or string | Yes      | -       | Full replacement Template resource; the update replaces the template entirely, so include every field it should keep. Workflow: gtm\_get\_template -> edit the payload -> gtm\_update\_template. Full CustomTemplate resource (object or JSON string) matching the Google Tag Manager API v2 CustomTemplate spec. Must include name; templateData holds the exported template (.tpl) text. To install a community template instead, use gtm\_import\_template\_from\_gallery. |

## Output

**Type**: `Dict`

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