---
title: "Create a template"
method: POST
path: "/workspaces/{workspaceId}/templates"
tags: ["templates"]
---

# Create a template

`POST /workspaces/{workspaceId}/templates`

## Request

- Base URL: `https://vetnio.com/api/v2`
- URL: `https://vetnio.com/api/v2/workspaces/{workspaceId}/templates`
- Auth: HTTP bearer

Creates a prompt template in the clinic, owned by the calling user and stamped with their current clinic role (`creatorRole`). Pass the returned `templateId` to Generate a clinical note to use it.

Write the body as reusable instructions, not as an example patient record: anything written as fixed text can appear in every generated document. Creating a template does not change any existing record.

The caller must be a direct member of the clinic (organization admins without a clinic membership cannot create templates). A clinic can hold about 100 templates; beyond that creation fails. The API does not apply the clinic's Strict Mode creation block, but a member's template is then hidden from that member under Strict Mode. Not idempotent: repeating the call creates another template. Requires a personal API key.

## Path parameters

- `workspaceId` string, required: Identifier of the clinic (workspace), as returned by `GET /workspaces`. The key's user must be a member of the clinic, or an admin of the organization it belongs to.

## Request body

- object
  - `template` string, required: The template body: the headings of the document, each followed by instructions in parentheses saying what belongs there, how to format it and what to write when the information is missing. HTML as produced by Vetnio's template editor; plain text is also accepted. Unsafe markup is removed before saving. No length limit is enforced by the API (Vetnio's editor stops at 150,000 characters).
  - `name` string, required: Template Name shown in Vetnio's template lists and pickers. Does not need to be unique. Name it after the purpose or reader, not a patient.
  - `type` 'clinical_note' | 'referral' | 'client_communication': The Template Type: which kind of document the template writes. Defaults to `clinical_note` when omitted. - `clinical_note` — Clinical Note: the medical record of the visit. - `client_communication` — Client Communication: an owner-facing message. - `referral` — Referral: a letter to or from another clinician or clinic.
  - `jsonTemplateId` string, nullable: ID of a JSON template (structured template) to link, from List JSON templates. When set, clinical notes generated on consultations that use this template are produced as structured JSON documents with this template's instructions guiding the field content. Omit or pass `null` for a free-text template. An ID the caller cannot read returns 404.

## Response `200`

The template was created; its ID is returned.

- CreateTemplateOutput: The ID of the template that was created.
  - `templateId` string, required: ID (a UUID) of the new template.

## Other responses

- `400`: Invalid input data
- `401`: Authorization not provided
- `403`: Insufficient access
- `500`: Internal server error

---

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