---
title: "Update template content"
method: PUT
path: "/workspaces/{workspaceId}/templates/{templateId}"
tags: ["templates"]
---

# Update template content

`PUT /workspaces/{workspaceId}/templates/{templateId}`

## Request

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

Replaces the body of a template. The name, type and structured-template link are unchanged and cannot be edited through this API. The previous body is kept in the template's history in Vetnio.

The change applies to every future generation that uses the template, for every user of the clinic; records generated earlier are not rewritten.

Who may update: the template's creator, clinic admins, and, when the clinic's template permissions are Full Access, members for other members' templates that are not managed. Others get 403, as does any attempt to update a Vetnio default template (duplicate it first). A template the caller cannot see returns 404. A stale `expectedContentVersion` returns 409. 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.
- `templateId` string, required: ID of the template (a UUID), as returned by List templates or Create a template. The template must belong to the workspace in the path and be visible to the caller under the clinic's template permissions; otherwise the request returns 404.

## Request body

- object
  - `template` string, required: The complete new template body, in the same format as when creating a template (headings with instructions in parentheses; HTML or plain text). It replaces the current body entirely. Unsafe markup is removed before saving.
  - `expectedContentVersion` string, nullable: Optimistic-concurrency guard: the `contentVersion` returned by your previous update of this template, sent unchanged including its double quotes. If the template body has changed since then, the update is rejected with 409 and nothing is saved. Omit it or pass `null` to overwrite unconditionally.

## Response `200`

The new body was saved; `contentVersion` identifies it.

- UpdateTemplateContentOutput: Confirms the new template body was saved and returns its version tag.
  - `success` boolean, required: Always `true` when the request succeeds; failures are returned as an HTTP error status instead.
  - `contentVersion` string, nullable: Opaque version tag of the content you just saved, including its surrounding double quotes. Send it unchanged as `expectedContentVersion` on your next update so that the update fails with 409 if someone else changed the template in between. `null` if storage did not return one.

## Other responses

- `400`: Invalid input data
- `401`: Authorization not provided
- `403`: Insufficient access
- `404`: Not found
- `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)
