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

# Update Template

> Update an existing email template. Send only the fields you want to change.

## Headers

<ParamField header="Authorization" type="string" required>
  `Bearer YOUR_API_KEY`
</ParamField>

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

## Path Parameters

<ParamField path="id" type="string" required>
  The template ID to update.
</ParamField>

## Body

All fields are optional — only provided fields are updated.

<ParamField body="name" type="string">
  New template name.
</ParamField>

<ParamField body="subject" type="string">
  New default subject line. Supports `{{variable}}` syntax.
</ParamField>

<ParamField body="html_content" type="string">
  New HTML body.
</ParamField>

<ParamField body="text_content" type="string">
  New plain text body.
</ParamField>

<ParamField body="category" type="string">
  New category. Values: `transactional`, `marketing`, `notification`, `welcome`, `custom`.
</ParamField>

## Response

Returns the updated template object.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT https://api.usegately.com/api/v1/email/templates/tmpl_abc123 \
    -H "Authorization: Bearer gately_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "subject": "Welcome to {{project}} 👋",
      "html_content": "<h1>Hey {{name}}, glad you are here!</h1>"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.usegately.com/api/v1/email/templates/tmpl_abc123',
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer gately_YOUR_API_KEY',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        subject: 'Welcome to {{project}} 👋',
        html_content: '<h1>Hey {{name}}, glad you are here!</h1>',
      }),
    }
  );

  const updated = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.put(
      'https://api.usegately.com/api/v1/email/templates/tmpl_abc123',
      headers={
          'Authorization': 'Bearer gately_YOUR_API_KEY',
          'Content-Type': 'application/json',
      },
      json={
          'subject': 'Welcome to {{project}} 👋',
          'html_content': '<h1>Hey {{name}}, glad you are here!</h1>',
      }
  )

  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "id": "tmpl_abc123",
    "name": "Welcome Email",
    "subject": "Welcome to {{project}} 👋",
    "html_content": "<h1>Hey {{name}}, glad you are here!</h1>",
    "category": "welcome",
    "updated_at": "2026-08-18T14:00:00Z"
  }
  ```

  ```json Not found (404) theme={null}
  {
    "error": "Template not found"
  }
  ```
</ResponseExample>
