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

# Update Template

> Update an email template

Update template metadata, labels, or content. You can pass an email template ID; transactional email IDs and slugs are also resolved for compatibility.

## Request

<ParamField path="templateId" type="string" required>
  Template ID, transactional email ID, or transactional slug.
</ParamField>

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

<ParamField body="subject" type="string">
  Updated email subject line.
</ParamField>

<ParamField body="html" type="string">
  Replacement HTML body. Use this or `blocks`, not both.
</ParamField>

<ParamField body="blocks" type="array">
  Replacement Sequenzy email blocks. Use this or `html`, not both. Put block
  styling under `styles`; top-level style keys like `backgroundColor`,
  `backgroundOpacity`, `borderColor`, `borderWidth`, and `borderRadius` are
  normalized into `styles`.
</ParamField>

<ParamField body="labels" type="array">
  Replacement label names. Send an empty array to clear labels. Missing labels
  are created automatically. The API also accepts `label` as a compatibility
  alias.
</ParamField>

```bash theme={null}
curl -X PUT "https://api.sequenzy.com/api/v1/templates/email_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject": "Welcome to Acme", "labels": ["edm"]}'
```

## Responses

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "template": {
      "id": "email_abc123",
      "name": "[Template] Welcome",
      "subject": "Welcome to Acme",
      "labels": ["edm"]
    }
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Provide at least one of: name, subject, html, blocks, labels."
  }
  ```

  ```json 401 theme={null}
  {
    "success": false,
    "error": "Unauthorized"
  }
  ```

  ```json 404 theme={null}
  {
    "success": false,
    "error": "Template not found"
  }
  ```

  ```json 500 theme={null}
  {
    "success": false,
    "error": "Failed to update template"
  }
  ```
</ResponseExample>
