---
title: "PATCH /v1/mailboxes/{mailboxId}/templates/{templateId}"
method: PATCH
path: "/v1/mailboxes/{mailboxId}/templates/{templateId}"
---

# PATCH /v1/mailboxes/{mailboxId}/templates/{templateId}

`PATCH /v1/mailboxes/{mailboxId}/templates/{templateId}`

## Request

- The document declares no server URL.
- Auth: one of:
  - OAuth 2 (authorization code, authorization URL `/authorize`, token URL `/oauth/token`, scopes: `email.write`)
  - HTTP bearer

Edit a template's content.

## Path parameters

- `mailboxId` string, required
- `templateId` string, required

## Request body

- TemplateUpdate: A content patch. `name` is absent on purpose — it is immutable; rename is delete-and-recreate.
  - `subject` string: RFC 5322 caps a subject line at 998 characters.
  - `html` string: Per-part body cap — generous for transactional mail, bounds abuse and cost.
  - `text` string: Per-part body cap — generous for transactional mail, bounds abuse and cost.

## Response `200`

The request has succeeded.

- Template
  - `id` string, required
  - `name` string, required
  - `subject` string, required
  - `html` string, nullable, required
  - `text` string, nullable, required
  - `variables` string[], required: The merge variables found in the subject and body, so a caller knows what `data` must supply.
  - `createdAt` string, date-time, required
  - `updatedAt` string, date-time, required

## Other responses

- `401`: Access is unauthorized.
- `403`: Access is forbidden.
- `404`: The server cannot find the requested resource.
- `422`: Client error
- `default`: An unexpected error response.

---

[API](https://skmtc.dev/foundermail/apis/mailbox.md) - [All operations](https://skmtc.dev/foundermail/apis/mailbox/llms.txt) - [OpenAPI document](https://skmtc.dev/foundermail/apis/mailbox/revisions/6a50628a86ed?raw)
