# Templates API

Manage reusable MJML content referenced by sends.

## Endpoints

- `GET /v1/templates`
- `POST /v1/templates`
- `GET /v1/templates/{id}`
- `PATCH /v1/templates/{id}`
- `DELETE /v1/templates/{id}`

## Create a template

MJML is compiled on save (invalid MJML → `400`). Reference it by id from a campaign or transactional send. Use `{{ contact.first_name }}` for personalization.

```bash
curl -X POST https://emailbump.com/api/v1/templates \
  -H "Authorization: Bearer ebk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome",
    "subject": "Welcome to Acme",
    "mjml": "<mjml><mj-body><mj-section><mj-column><mj-text>Hi {{ contact.first_name }}</mj-text></mj-column></mj-section></mj-body></mjml>"
  }'
```

```json
{
  "template": {
    "id": "9f2a3b4c-5d6e-7f8a-9b0c-1d2e3f4a5b6c",
    "name": "Welcome",
    "subject": "Welcome to Acme",
    "mjml": "<mjml>…</mjml>",
    "compiled_html": "<!doctype html>…",
    "created_at": "2026-07-21T19:56:38+00:00",
    "updated_at": "2026-07-21T19:56:38+00:00"
  }
}
```
