---
title: "Publish a template"
method: POST
path: "/v1/templates/{id}/publish"
tags: ["Templates"]
---

# Publish a template

`POST /v1/templates/{id}/publish`

## Request

- Base URL: `https://smtpfa.st/api`
- URL: `https://smtpfa.st/api/v1/templates/{id}/publish`
- Auth: HTTP bearer

Publish the current draft. From then on, sends that name this template render this version; later edits change only the draft until the next publish. Pass the updated_at you loaded as expected_updated_at to publish only that version: if the template changed since, it answers 409 revision_conflict. Requires the email:send scope.

## Path parameters

- `id` string, required

## Request body

- object
  - `expected_updated_at` string, date-time: Not in Resend. The updated_at you loaded.

## Response `200`

Template published

- TemplateRef: Resend's { id, object }. Create, update and publish also return the fields below (not in Resend): updated_at is the revision that write set, to pass as expected_updated_at next time.
  - `id` string
  - `object` string
  - `updated_at` string, date-time: Not in Resend. The revision this write created.
  - `status` 'draft' | 'published': Not in Resend.
  - `published_at` string, date-time, nullable: Not in Resend.
  - `has_unpublished_versions` boolean: Not in Resend.

## Other responses

- `401`: Invalid or missing API key
- `403`: Forbidden - domain not verified or insufficient permissions
- `404`: Resource not found
- `409`: Conflict - the resource already exists or changed meanwhile
- `422`: The request is well formed but cannot be carried out in the current state, for example an unpublished template
- `429`: Rate limit exceeded - retry after the period indicated in the Retry-After header
- `500`: Internal server error

---

[API](https://skmtc.dev/smtpfa/apis/smtpfast-api.md) · [All operations](https://skmtc.dev/smtpfa/apis/smtpfast-api/llms.txt) · [OpenAPI document](https://skmtc.dev/smtpfa/apis/smtpfast-api/revisions/79dda742f53e?raw)
