Skip to content

Create template​

POST
/api/v1/templates

Creates a template in visual mode (when blocks is supplied) or code mode (when code is supplied without blocks). Pass an optional folder path (e.g. marketing/onboarding) to file it: missing folders along the path are created, and the response echoes the resolved folder. The folder is unrelated to the template name. Requires an API key: presigned tokens are template-scoped and there is no template yet to scope to.

Authorizations​

ApiKeyAuth

Long-lived account credential. Create one from the dashboard.

Type
API Key (header: x-api-key)

Request Body​

application/json
Min Length1
Max Length128

Structural JSON value: object or array. Scalars and null are rejected.

Block tree (visual mode). Authored via the editor; rarely hand-written. See the Postcraft dashboard's editor for the full discriminated union of block kinds.

Email subject line, as Handlebars rendered against the render context. null removes it; omit it to keep the stored one.

Max Length998

Folder path to file the template under, e.g. "marketing/onboarding". Segments are created if missing. Unrelated to the template name.

Max Length512

Responses​

Template created.

application/json

Problems found in the template. Advisory rather than fatal: a template that renders can still carry warnings, while an error severity is one that will not.

Playground​

Authorization
Body

Samples​