Skip to main content

Templates

Templates are reusable designs with dynamic content areas called variables. Create a template once, then render it with different data to generate unique images.

Creating Templates

Visual Editor

The dashboard provides a drag-and-drop editor for creating templates:
  1. Go to Templates in the dashboard
  2. Click Create Template
  3. Use the canvas to add text, images, shapes, and backgrounds
  4. Mark elements as variables by clicking the variable icon
  5. Save your template

HTML/CSS Import

You can also create templates from HTML/CSS:

Variables

Variables are placeholders that get replaced with actual values when rendering. Define variables using double curly braces: {{variableName}}.

Variable Types

Variable Definitions

Each variable can have a definition that includes:

Getting Template Variables

Retrieve variable definitions before rendering:

Rendering Templates

Render a template by providing values for its variables:

Template Structure

Templates are stored as FabricJS canvas data with additional metadata:

Output Formats

Templates support multiple output formats: Set the output format when rendering:

Multi-Page Templates

PDF templates can have multiple pages — one page per variable set. This is served by the POST /pdf/multi-page REST endpoint, which the SDKs don’t wrap directly:
See the PDF Generation reference for paper sizes, margins, and orientation options.

Listing Templates

List your templates with pagination. listTemplates returns { templates, pagination }:

Best Practices

  1. Use descriptive variable names: authorProfileImage instead of img1
  2. Set default values: Ensure templates render even with missing data
  3. Validate input: Use validation rules to catch errors early
  4. Keep templates focused: One template per use case
  5. Version templates: Use naming conventions like og-image-v2