# Create template

> Create a template.

Source: https://sndr.sh/docs/api/templates/create-template

`POST https://api.sndr.sh/v1/templates`

Create a template. Returns 201 with the template. HTML is sanitized on save: scripts, <style> blocks and event handlers are removed; inline styles stay.

Scope: `send`

**Body** (JSON)

- `name` (string, required): Internal name (not shown to recipients), 1–200 characters.
- `subject` (string, required): Subject line, max 998 characters. Supports {{ variable }} placeholders.
- `html` (string): HTML body. Either html or text is required.
- `text` (string): Plain-text body.

**Request**

```bash
curl -X POST 'https://api.sndr.sh/v1/templates' \
  -H "Authorization: Bearer $SNDR_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "name":    "Order confirmation",
    "subject": "Your order #{{ order_id }} is confirmed",
    "html":    "<h1>Hi {{ first_name }},</h1><p>Order #{{ order_id }} confirmed.</p>",
    "text":    "Hi {{ first_name }}, order #{{ order_id }} confirmed."
  }'
```

**Response** (201)

```json
{
  "id":              "tpl_c19e5d34-82a",
  "organization_id": "org_8d41c7a2-3f6",
  "name":            "Order confirmation",
  "subject":         "Your order #{{ order_id }} is confirmed",
  "html":            "<h1>Hi {{ first_name }},</h1><p>Order #{{ order_id }} confirmed.</p>",
  "text":            "Hi {{ first_name }}, order #{{ order_id }} confirmed.",
  "version":         1,
  "created_at":      "2026-06-01T12:00:00Z",
  "updated_at":      "2026-06-01T12:00:00Z"
}
```

**Errors**

- `unauthenticated` (401): Missing or invalid API key.
- `invalid_request` (400): Body is not valid JSON, has an unknown field, or a field has the wrong type.
- `plan_limit_reached` (402): The plan’s template limit is reached.
- `insufficient_scope` (403): The API key is missing the send scope.
- `validation_failed` (422): name or subject is missing or too long, or both html and text are empty.
