Image APIs
API reference › Templates

Replace a template's definition

PUT/v1/templates/{id}

PUT/v1/templates/{id}

Replace a template's definition

Send the whole template; what you send is what is kept. Renders already made from it are unaffected; signed URLs pick up the new version.

PARAMETERS
idpath · stringREQUIRED
The template id
e.g. tpl_4nq8vzk2hdyw7bxme3rc
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 PUT "https://api.imageapis.com/v1/templates/tpl_4nq8vzk2hdyw7bxme3rc" \
  -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
200OK
{
  "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.