curl --request POST \
--url https://api.pictify.io/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "OG Image",
"engine": "html",
"width": 1200,
"height": 630,
"html": "<div style=\"width:1200px;height:630px;padding:64px;font-family:Inter\">\n <h1 style=\"font-size:72px\">{{title}}</h1>\n <p style=\"font-size:32px;color:#6b7280\">{{subtitle}}</p>\n {{#if showCta}}<button>{{ctaText}}</button>{{/if}}\n</div>\n",
"variableDefinitions": [
{
"name": "title",
"type": "text",
"defaultValue": "Hello world"
},
{
"name": "subtitle",
"type": "text"
},
{
"name": "showCta",
"type": "boolean",
"defaultValue": false
},
{
"name": "ctaText",
"type": "text",
"defaultValue": "Learn more"
}
],
"strictVariables": false,
"jsEnabled": false
}
'{
"template": {
"uid": "<string>",
"name": "<string>",
"engine": "fabric",
"html": "<string>",
"fabricJSData": {},
"jsEnabled": false,
"strictVariables": false,
"type": "<string>",
"category": "<string>",
"tags": [
"<string>"
],
"width": 123,
"height": 123,
"thumbnail": "<string>",
"outputFormat": "image",
"pdfPreset": "A4",
"variableDefinitions": [
{
"name": "<string>",
"type": "text",
"defaultValue": "<unknown>",
"description": "<string>",
"allowRawHtml": false,
"validation": {
"required": true,
"minLength": 123,
"maxLength": 123
}
}
],
"pages": [
{
"pageNumber": 123,
"name": "<string>",
"fabricJSData": {}
}
],
"layouts": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"addedVariables": [
"<string>"
]
}{
"error": "<string>",
"code": "<string>",
"context": {}
}Create Template
Create a template with either the Handlebars HTML engine or the FabricJS canvas engine.
curl --request POST \
--url https://api.pictify.io/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "OG Image",
"engine": "html",
"width": 1200,
"height": 630,
"html": "<div style=\"width:1200px;height:630px;padding:64px;font-family:Inter\">\n <h1 style=\"font-size:72px\">{{title}}</h1>\n <p style=\"font-size:32px;color:#6b7280\">{{subtitle}}</p>\n {{#if showCta}}<button>{{ctaText}}</button>{{/if}}\n</div>\n",
"variableDefinitions": [
{
"name": "title",
"type": "text",
"defaultValue": "Hello world"
},
{
"name": "subtitle",
"type": "text"
},
{
"name": "showCta",
"type": "boolean",
"defaultValue": false
},
{
"name": "ctaText",
"type": "text",
"defaultValue": "Learn more"
}
],
"strictVariables": false,
"jsEnabled": false
}
'{
"template": {
"uid": "<string>",
"name": "<string>",
"engine": "fabric",
"html": "<string>",
"fabricJSData": {},
"jsEnabled": false,
"strictVariables": false,
"type": "<string>",
"category": "<string>",
"tags": [
"<string>"
],
"width": 123,
"height": 123,
"thumbnail": "<string>",
"outputFormat": "image",
"pdfPreset": "A4",
"variableDefinitions": [
{
"name": "<string>",
"type": "text",
"defaultValue": "<unknown>",
"description": "<string>",
"allowRawHtml": false,
"validation": {
"required": true,
"minLength": 123,
"maxLength": 123
}
}
],
"pages": [
{
"pageNumber": 123,
"name": "<string>",
"fabricJSData": {}
}
],
"layouts": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"addedVariables": [
"<string>"
]
}{
"error": "<string>",
"code": "<string>",
"context": {}
}engine field.
| Engine | Authoring surface | Use it when |
|---|---|---|
html | Raw HTML + Handlebars ({{var}}, {{#each}}, {{#if}}, helpers) | You want full control over markup, CSS, and copy-paste-able source. |
fabric | FabricJS canvas JSON | You’re exporting from the dashboard editor or automating canvas layouts. |
engine, Pictify infers it from the payload: a request with html and no
fabricJSData becomes an html template; anything else is fabric. Set it explicitly
anyway so the intent is clear.Handlebars HTML templates
Setengine: "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 -X POST https://api.pictify.io/templates \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "OG Image",
"engine": "html",
"width": 1200,
"height": 630,
"html": "<div style=\"width:1200px;height:630px;padding:64px;font-family:Inter\"><h1 style=\"font-size:72px\">{{title}}</h1><p style=\"font-size:32px;color:#6b7280\">{{subtitle}}</p>{{#if showCta}}<button>{{ctaText}}</button>{{/if}}</div>",
"variableDefinitions": [
{ "name": "title", "type": "text", "defaultValue": "Hello world" },
{ "name": "subtitle", "type": "text" },
{ "name": "ctaLabel", "type": "text", "defaultValue": "Learn more" },
{ "name": "ctaText", "type": "text", "defaultValue": "Learn more" }
]
}'
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:
{
"template": {
"uid": "tmpl_...",
"engine": "html",
"variableDefinitions": [
{ "name": "title", "type": "text" },
{ "name": "price", "type": "text" }
]
},
"addedVariables": ["price"]
}
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
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
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.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 Handlebars syntax in Expressions for block syntax and the full helper library.<p>{{titleCase title}}</p>
<p>{{currency price 'USD'}}</p>
<p>{{date publishedAt 'MMM D, YYYY'}}</p>
{{#each items}}
<li>{{@index}}. {{this.name}} — {{currency this.price 'USD'}}</li>
{{/each}}
FabricJS canvas templates
Setengine: "fabric" and pass a FabricJS canvas JSON
object in fabricJSData. Multi-page canvases are supported via pages.
curl -X POST https://api.pictify.io/templates \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Quote card",
"engine": "fabric",
"width": 1080,
"height": 1080,
"fabricJSData": { "version": "5.3.0", "objects": [] }
}'
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 withPOST /templates/{uid}/render
and pass variable values in the variables object.
curl -X POST https://api.pictify.io/templates/tmpl_abc123/render \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"variables": { "title": "Launch day", "subtitle": "Ship it" },
"format": "png"
}'
Authorizations
API key obtained from the Pictify dashboard
Body
Human-readable template name. Shown in the dashboard.
Template engine. Set html to author with Handlebars + HTML.
fabric, html Required for engine=html. Handlebars source. Must compile.
Undeclared {{identifier}} references are auto-added as text variables.
Required for engine=fabric. FabricJS canvas JSON.
Render width in px.
Render height in px.
Template type tag (e.g. og-image, twitter-card). Free-form.
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.
Show child attributes
Show child attributes
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.
engine=html only. When true, missing root-level variables throw
HTTP 422 at render time. Leave off if you rely on {{#if optional}} guards.
image, pdf Page preset when outputFormat=pdf.
A4, A4_LANDSCAPE, LETTER, LETTER_LANDSCAPE, LEGAL, A3, TABLOID Multi-page canvas pages (engine=fabric only).
Show child attributes
Show child attributes