PUT
https://api.craftkit.dev/v1/templates/{slug}slug — the idempotent companion to
POST /v1/templates. It re-runs the same manifest → layout
synthesis as create, so a template authored before a layout feature shipped (for example image
blocks) can be regenerated in place instead of orphaning its slug to a -v2.
- Template does not exist → it is created and published as version 1 →
201. - Template exists → a new version (n+1) is published and becomes current →
200.
Existing renders are never affected. Each render pins its own
templateVersionId, so
republishing only changes what new renders use — previously rendered PDFs are immutable.Authorization
Bearer ck_live_… — must own the project that holds (or will hold) the template.Path
The canonical kebab-case slug. The URL slug wins — any
slug in the body is ignored.Body
The body is the same shape as create (minusslug, which comes
from the URL).
Display name (1–120 chars). Replaces the stored name on republish.
Optional, up to 280 chars. Replaces the stored description on republish.
The variable manifest the render payload binds to.
Optional CanvasDocument
contentJson override. When omitted, it is regenerated from the manifest.Optional page format (
format, orientation, margin, printBackground). Defaults to A4 portrait.Response
200 (republished) or 201 (created):
The canonical slug (the one in the URL).
The newly published version.
1 on create; incremented by one on every republish.The stored manifest, echoed back.
Each republish creates a new version even when the manifest is unchanged — calling PUT N times
leaves N versions in history. This is intentional (it keeps
currentVersionNumber advancing) and
harmless to existing renders.Errors
| Status | code | Meaning |
|---|---|---|
| 400 | invalid_json | Body is not valid JSON. |
| 400 | invalid_request | Envelope, manifest, or pageConfig failed validation (issues included). |
| 400 | invalid_loop_key | A loop key contains a dot — use a dot-free top-level key. |
| 401 | unauthorized | Missing/invalid key. |
| 409 | slug_conflict | The slug is occupied by another (possibly soft-deleted) template — DELETE it first or pick a new slug. |
| 409 | version_conflict | Concurrent republishes raced for the next version number — retry. |
cURL
200