---
title: "Update a template"
method: PATCH
path: "/v1/templates/{id}"
tags: ["Templates"]
---

# Update a template

`PATCH /v1/templates/{id}`

## Request

- Base URL: `https://api.samva.dev`
- URL: `https://api.samva.dev/v1/templates/{id}`
- Auth: API key in header `x-api-key`

Updates template metadata. Setting `entryPath` points the template at another file in its project and keeps its id, slug, and publications; move the file in Git separately. Source changes use the project workspace API.

## Path parameters

- `id` string, required

## Request body

- UpdateTemplatePayload
  - `data` object, required
    - `name` string, nullable
    - `slug` string, nullable
    - `entryPath` string, nullable
    - `description` string, nullable
    - `category` 'transactional' | 'marketing' | 'support' | 'notification' | 'verification' | 'reminder' | 'alert', nullable
    - `fromDefault` TemplateFromDefault
      - `email` string, required
      - `name` string, nullable
    - `replyToDefault` string[], nullable
    - `isActive` boolean, nullable
    - `shared` boolean, nullable: Share the template's project with every namespace, or stop sharing it. Applies to every entry in the project. Only an organization-level project is shared.

## Response `200`

Template

- Template
  - `id` string, required
  - `slug` string, required
  - `name` string, required
  - `channel` 'email', required
  - `projectId` string, required
  - `namespaceId` string, required
  - `shared` boolean, required: Whether the template's project is shared with every namespace. Every entry in a project shares it. A namespace-scoped key reads and sends a shared template in its own namespace but cannot change it. Only an organization-level project is shared.
  - `entryPath` string, required
  - `status` 'draft' | 'pending' | 'approved' | 'published' | 'rejected' | 'archived', required
  - `isActive` boolean, required
  - `publishedAt` string, nullable, required
  - `brand` TemplatePublicationBrand, required
    - `slug` string, required: The brand the publication imports.
    - `digest` string, required: The brand's digest when the publication was built.
    - `stale` boolean, required: Whether the brand has changed since this publication was built. Publishing the same commit again picks up the change.
  - `fromDefault` TemplateFromDefault, required
    - `email` string, required
    - `name` string, nullable
  - `usageCount` integer, required
  - `lastUsedAt` string, nullable, required
  - `createdAt` string, required
  - `updatedAt` string, required
  - `familyId` string, required
  - `description` string, nullable, required
  - `category` 'transactional' | 'marketing' | 'support' | 'notification' | 'verification' | 'reminder' | 'alert', nullable, required
  - `replyToDefault` string[], nullable, required
  - `trackingDefault` object, nullable, required
    - `opens` boolean, nullable
    - `clicks` boolean, nullable
  - `email` object, nullable, required
    - `subject` string, required
    - `preheader` string, nullable, required
    - `headers` object, nullable, required
  - `publicationId` string, required
  - `inputContractId` string, required
  - `inputSchema` object, nullable, required

## Other responses

- `401`: UnauthorizedError
- `403`: ForbiddenError
- `404`: ResourceNotFoundError
- `409`: ConflictError
- `422`: ValidationError
- `500`: InternalError
- `504`: GatewayTimeoutError

---

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