Skip to main content
POST
Pictify templates come in two flavours. Pick one with the engine field.
If you omit engine, the API defaults to fabric for backwards compatibility. New HTML templates should set engine: "html" explicitly.

Handlebars HTML templates

Set engine: "html" and pass your template source in html. Pictify compile-validates it on save and fails with HTTP 422 if a block is unclosed or a helper is unknown.
cURL

Auto-added variables

Any {{identifier}} referenced in the template body that is not declared in variableDefinitions is automatically added as a text variable on save. The response echoes the added names under addedVariables so your client can surface them:
This is what makes the engine=html authoring loop feel “just work” — you can type {{price}} into your template and save; the variable appears on the next read without a separate declaration step.

strictVariables and jsEnabled

Two HTML-only toggles affect render behaviour:

strictVariables

When true, rendering fails with HTTP 422 if a root-level variable referenced in the template was not supplied. Leave off if you rely on {{#if optional}} guards.

jsEnabled

When true, scripts inside the template execute during render (Chart.js, KaTeX, animated SVG). Off by default to prevent runaway loops. A 30s hard timeout always applies.
Both default to false and can be flipped with PUT /templates/{uid}.

Helpers and expressions

HTML templates have access to the full Pictify helper library — string casing, number and currency formatting, date formatting, array helpers, and JSON inspection. See Expressions for the complete reference.

FabricJS canvas templates

Set engine: "fabric" (or omit — it’s the default) and pass a FabricJS canvas JSON object in fabricJSData. Multi-page canvases are supported via pages.
cURL
Base64 data:image/... sources inside fabricJSData are uploaded to Pictify storage during save and replaced with CDN URLs. No extra step needed.

Rendering

Once saved, render with POST /templates/{uid}/render and pass variable values in the variables object.
cURL

Authorizations

Authorization
string
header
required

API key obtained from the Pictify dashboard

Body

application/json
name
string
required

Human-readable template name. Shown in the dashboard.

engine
enum<string>
default:fabric

Template engine. Set html to author with Handlebars + HTML.

Available options:
fabric,
html
html
string

Required for engine=html. Handlebars source. Must compile. Undeclared {{identifier}} references are auto-added as text variables.

fabricJSData
object

Required for engine=fabric. FabricJS canvas JSON.

width
integer

Render width in px.

height
integer

Render height in px.

type
string

Template type tag (e.g. og-image, twitter-card). Free-form.

category
string
tags
string[]
variableDefinitions
object[]

Variable schema. For engine=html, identifiers referenced in the template body but not declared here are auto-added as text variables and returned under addedVariables in the response.

jsEnabled
boolean
default:false

engine=html only. When true, scripts inside the template execute at render time. Enables Chart.js, KaTeX, and animated SVG. Disables infinite-loop protection; the 30s hard timeout still applies.

strictVariables
boolean
default:false

engine=html only. When true, missing root-level variables throw HTTP 422 at render time. Leave off if you rely on {{#if optional}} guards.

outputFormat
enum<string>
default:image
Available options:
image,
pdf
pdfPreset
enum<string>
default:A4

Page preset when outputFormat=pdf.

Available options:
A4,
A4_LANDSCAPE,
LETTER,
LETTER_LANDSCAPE,
LEGAL,
A3,
TABLOID
pages
object[]

Multi-page canvas pages (engine=fabric only).

Response

Template created

template
object
addedVariables
string[]

engine=html only. Names of identifiers referenced in the template body that were auto-added to variableDefinitions during save. Omitted when the array would be empty.