---
title: "Generate Template"
method: POST
path: "/v1/templates/generate"
tags: ["templates"]
---

# Generate Template

`POST /v1/templates/generate`

## Request

- Base URL: `https://api.mentium.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.mentium.io/v1/templates/generate`
- Auth: HTTP bearer

Generate a template using AI based on user description.
Uses only valid {{variable}} syntax from LoadTemplateSchema, CarrierTemplateSchema, OfferTemplateSchema.

## Headers

- `mentium-workspace-id` string, nullable

## Request body

- TemplateGenerateRequest: Request schema for AI template generation
  - `prompt` string, required
  - `template_type` 'EMAIL' | 'SMS'

## Response `200`

Successful Response

- TemplateGenerateResponse: Response schema for AI template generation
  - `subject` string, nullable
  - `body` string, required

## Other responses

- `404`: Not found
- `422`: Validation Error

---

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