---
title: "Create or update a template by name"
method: POST
path: "/api/v1/templates"
tags: ["templates"]
---

# Create or update a template by name

`POST /api/v1/templates`

## Request

- Base URL: `https://api.pressa.dev`
- URL: `https://api.pressa.dev/api/v1/templates`
- Auth: none declared

Idempotent on `name`: an existing template with the same name is updated and `created` is false. `placeholder_engine: "liquid"` saves a placeholder template for the render endpoint, and converts an existing raw LaTeX template in place (`promoted` is true). A source containing Liquid placeholders sent without `placeholder_engine` is refused with `liquid_placeholders_in_v1_template`, because raw LaTeX would print them literally.

## Request body

- object
  - `name` string, required
  - `latex_content` string: Required for a new template. Optional on an update, and when converting the saved source with placeholder_engine "liquid".
  - `description` string
  - `instructions` string
  - `placeholder_engine` 'liquid' | 'none': "liquid": the source contains Liquid placeholders, filled by the render endpoint. "none": raw LaTeX whose braces only look like placeholders. Omit to keep the template's current kind.

## Response `200`

Existing template updated.

## Other responses

- `201`: Template created.
- `401`: Missing or invalid API key.
- `422`: `validation_failed` (with a `fields` list naming each field, rule and limit), `liquid_placeholders_in_v1_template`, `liquid_syntax_error`, `template_security_violation`, `engine_downgrade_not_supported` or `invalid_placeholder_engine`. Every refusal leaves the template unchanged.

---

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