---
title: "Create a template"
method: POST
path: "/templates"
tags: ["Templates"]
---

# Create a template

`POST /templates`

## Request

- Base URL: `https://api.mepmail.dev`
- URL: `https://api.mepmail.dev/templates`
- Auth: HTTP bearer

Creates a reusable email template; every save is live.

## Request body

- CreateTemplateRequest
  - `name` string, required
  - `subject` string, nullable: "" or null clears the subject
  - `html` string, required: Stored as sent; the dashboard sanitizes at render
  - `text` string, nullable: "" or null clears the text part
  - `alias` string, nullable: Case-sensitive handle, unique per team; GET /templates/{alias} resolves it
  - `from` string, nullable: Not supported yet: any value is a 422
  - `reply_to` union: Not supported yet: any value is a 422
    - string
    - string[]
  - `variables` unknown[]: Not supported yet: a non-empty list is a 422
    - unknown

## Response `200`

Template created. Templates have no draft/publish cycle: every save is live, so status is always published.

- TemplateIdResponse
  - `object` 'template', required
  - `id` string, uuid, required

## Other responses

- `401`: Missing, malformed or invalid API key
- `409`: Alias already in use
- `422`: Validation error, including from/reply_to/variables (not supported yet)
- `429`: Rate limit exceeded: 600 requests per minute per API key and 3,000 per team; wait for Retry-After

---

[API](https://skmtc.dev/mepmail/apis/mepmail-api.md) · [All operations](https://skmtc.dev/mepmail/apis/mepmail-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mepmail/apis/mepmail-api/revisions/262a89f73730?raw)
