Image APIs
API reference › Templates

Save a template: positioned layers, or your own HTML

POST/v1/templates

POST/v1/templates

Save a template: positioned layers, or your own HTML

Layers are rendered bottom to top inside a canvas of width × height. Text layers shrink to fit their box by default. Put {{placeholders}} in text, src, html or css and fill them with variables at render time, or override any layer property by name with modifications. Set engine to html to bring your own HTML and CSS instead of layers.

REQUEST BODY · APPLICATION/JSON · REQUIRED
{
  "name": "Blog post card",
  "width": 1200,
  "height": 630,
  "background": "#0b1220",
  "layers": [
    {
      "name": "title",
      "type": "text",
      "x": 72,
      "y": 160,
      "width": 1056,
      "height": 280,
      "text": "{{title}}",
      "font": "Inter",
      "weight": 800,
      "size": 72,
      "color": "#ffffff",
      "fit": "shrink",
      "max_lines": 3
    },
    {
      "name": "site",
      "type": "text",
      "x": 72,
      "y": 72,
      "width": 600,
      "height": 40,
      "text": "apidirectory.com",
      "font": "Inter",
      "weight": 600,
      "size": 28,
      "color": "#a3b1c6"
    },
    {
      "name": "accent",
      "type": "rect",
      "x": 0,
      "y": 616,
      "width": 1200,
      "height": 14,
      "fill": "#6366f1"
    }
  ]
}
In the full reference
REQUEST
curl -X POST "https://api.imageapis.com/v1/templates" \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Blog post card",
  "width": 1200,
  "height": 630,
  "background": "#0b1220",
  "layers": [
    {
      "name": "title",
      "type": "text",
      "x": 72,
      "y": 160,
      "width": 1056,
      "height": 280,
      "text": "{{title}}",
      "font": "Inter",
      "weight": 800,
      "size": 72,
      "color": "#ffffff",
      "fit": "shrink",
      "max_lines": 3
    },
    {
      "name": "site",
      "type": "text",
      "x": 72,
      "y": 72,
      "width": 600,
      "height": 40,
      "text": "apidirectory.com",
      "font": "Inter",
      "weight": 600,
      "size": 28,
      "color": "#a3b1c6"
    },
    {
      "name": "accent",
      "type": "rect",
      "x": 0,
      "y": 616,
      "width": 1200,
      "height": 14,
      "fill": "#6366f1"
    }
  ]
}'
RESPONSE
201Created
{
  "id": "tpl_4nq8vzk2hdyw7bxme3rc",
  "object": "template",
  "name": "Blog post card",
  "engine": "layers",
  "width": 1200,
  "height": 630,
  "background": "#0b1220",
  "layers": [
    {
      "name": "title",
      "type": "text",
      "x": 72,
      "y": 160,
      "width": 1056,
      "height": 280,
      "text": "{{title}}",
      "font": "Inter",
      "weight": 800,
      "size": 72,
      "color": "#ffffff",
      "fit": "shrink",
      "max_lines": 3
    },
    {
      "name": "site",
      "type": "text",
      "x": 72,
      "y": 72,
      "width": 600,
      "height": 40,
      "text": "apidirectory.com",
      "font": "Inter",
      "weight": 600,
      "size": 28,
      "color": "#a3b1c6"
    },
    {
      "name": "accent",
      "type": "rect",
      "x": 0,
      "y": 616,
      "width": 1200,
      "height": 14,
      "fill": "#6366f1"
    }
  ],
  "created": "2026-10-10T17:40:02Z",
  "updated": "2026-10-10T17:40:02Z"
}
401Missing or invalid API key (from the gateway)
404No such template or record on this account
{
  "error": "string",
  "message": "string",
  "param": "string"
}
Try it — sign in first
Runs on a sandbox key: 200 requests a month. Your real key is for production.