---
title: "Publish a document as a template"
method: POST
path: "/templates"
tags: ["Templates"]
---

# Publish a document as a template

`POST /templates`

## Request

- Base URL: `https://api.varg.ai/v2`
- URL: `https://api.varg.ai/v2/templates`
- Auth: HTTP bearer

Copies one of your media documents into a new template and submits it
for moderation. The template is a frozen copy, so later edits to the
document do not change it. Requires a key bound to a user (a personal
API key, or `on_behalf_of_user_id`).

## Request body

- TemplateCreateRequest
  - `document_id` string, uuid, required: A media document you own. `documentId` is also accepted.
  - `description` string, required
  - `tags` string[]: Trimmed and lower-cased; empty tags are dropped and only the first five are kept. Each tag may be at most 30 characters.

## Response `201`

Template created and awaiting moderation

- TemplateCreated
  - `id` string, uuid
  - `status` string: New templates start in moderation, typically `pending`
  - `sourceDocumentId` string, uuid
  - `createdAt` string, date-time

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid API key / JWT
- `404`: Template or document not found
- `409`: A template already exists for this document
- `422`: The key is not bound to a user account

## Changes

- **2026-10-20** `43bcf5ea398d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/varg/apis/varg-api/changes/templates/post.md)

---

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