---
title: "Create an email template"
method: POST
path: "/templates/"
tags: ["Template"]
---

# Create an email template

`POST /templates/`

## Request

- Base URL: `https://api.your-domain.com`
- URL: `https://api.your-domain.com/templates/`
- Auth: API key in header `X-API-KEY`
- TypeScript: <https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/docs/templates/post.ts> (a function with typed inputs; its response is checked against the schema)

Create a new email template for the current user's tenant.

## Query parameters

- `tenant_id` integer
- `cookie_name` string, nullable

## Request body

- TemplateIn: Payload for creating or updating an email template.
  - `name` string, nullable: Human-readable label for the template. Max 100 characters.
  - `text_body` string, required: Plain-text body of the email.
  - `html_body` string, nullable: Optional HTML body of the email.

## Response `201`

Successful Response

- TemplateOut: Email template as returned by the API.
  - `id` integer, required: Unique identifier of the template.
  - `name` string, nullable, required: Human-readable label for the template.
  - `text_body` string, required: Plain-text body of the email.
  - `html_body` string, nullable, required: HTML body of the email, or null if none.

## Other responses

- `401`: Missing or invalid authentication.
- `403`: Admin privileges required.
- `422`: Validation Error

---

[API](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api.md) - [All operations](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/llms.txt) - [OpenAPI document](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/revisions/b53e89b98c2b?raw)
