create_template
Build reusable design templates programmatically with text, image, shape, and rating layers, including multi-page or multi-size layouts for image, video, and PDF renders.
Instructions
Create a new template programmatically with layers. IMPORTANT: Each layer must have a 'layer' field (unique identifier/name), not 'name'. Valid layer types are: 'text', 'image', 'shape', 'rating'. Use 'shape' for rectangles, circles, and other shapes - shapes require an 'html' field with SVG content. For a multi-page or multi-size template (several sizes in one template), pass 'pages' instead of 'layers': each page carries its own width/height and its layers as an object keyed by layer name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Template name | |
| pages | No | Pages for multi-page or multi-size templates (e.g. Instagram square, story and X landscape in ONE template, each with its own width/height). Use this INSTEAD of top-level 'layers'. Each page: 'page' (unique name), optional 'width'/'height' (fall back to the template size), and 'layers' as an OBJECT keyed by layer name (NOT an array). Same shape as get_template_pages returns. | |
| width | Yes | Template width in pixels | |
| height | Yes | Template height in pixels | |
| layers | No | Array of layer objects. Each layer MUST have 'layer' (unique name) and 'type' fields. | |
| duration | No | Default video duration in milliseconds for MP4 renders (e.g., 5000 for 5 seconds). Used as fallback when no duration is specified at render time. | |
| background | No | Template background color (e.g., '#ffffff', 'rgb(255,255,255)', 'transparent') |