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

# Create Template

> Create an email template

Create a reusable email template. You provide either raw `html` or Sequenzy `blocks`.

## Request

<ParamField body="name" type="string" required>
  Template name. Sequenzy stores API-created templates with a `[Template]`
  prefix.
</ParamField>

<ParamField body="subject" type="string" required>
  Email subject line.
</ParamField>

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

<ParamField body="blocks" type="array">
  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">
  Label names to assign to the template. Missing labels are created
  automatically. The API also accepts `label` as a compatibility alias.
</ParamField>

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/templates" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome",
    "subject": "Welcome!",
    "labels": ["edm"],
    "html": "<p>Thanks for joining.</p>"
  }'
```

## Responses

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

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Provide either html or blocks."
  }
  ```

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

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