---
title: Templates
description: Manage reusable Pixmato templates for API-driven image generation.
icon: layout-template
---

Templates are the source of truth for generated images.

## List templates

```txt
GET /v1/templates
```

## Get a template

```txt
GET /v1/templates/:id
```

## Create a template

Create and update operations require a dashboard session; API keys are read-only
for templates. Use the dashboard editor to design templates.

```txt
POST /v1/templates
```

## Update a template

```txt
PATCH /v1/templates/:id
```

## Shape shadows

Select a shape in the editor and click **+** beside **Shadow** to adjust its color, horizontal and vertical offsets, and blur. Shadows follow the shape's outline, including rounded corners, and appear in generated images.

Templates store the effect on the shape layer:

```json
{
  "shadow": {
    "color": "#233F3524",
    "offsetX": 0,
    "offsetY": 10,
    "blur": 16
  }
}
```

Offsets and blur use canvas pixels. Alpha in the color controls transparency. Omit `shadow` or set it to `null` to disable the effect. Scaling the canvas layers also scales shadow offsets and blur.

## Image and text effects

Image layers support corner radius, an inside border, shadow, and horizontal or vertical flipping. Text layers support shadow and outline. Add or remove these effects with the **+ / −** actions in the editor. Removing an effect can be undone.

Image and shape shadows follow visible pixels; text shadows follow the glyphs. Color alpha controls the effect's transparency independently of **Layer opacity**.

## Preview data before rendering

Click **Preview data** in the editor to cycle saved sample rows, try longer text or empty optional values, and edit temporary values. This instant browser preview does not generate images, spend render credits, save sample edits, or overwrite template defaults. It highlights possible text overflow and canvas clipping. Use **Test template** for a real API render and final validation of fonts, layout, and image crops.

## Keep related layers together

In **Layout**, set **Position below** to another layer and adjust **Gap**. For example, put recipe metadata below a headline using **Grow** text fitting. As the headline grows, the metadata moves down, both in the editor and in API-generated images.

The template stores `flowAfterId` and `flowGap` on the following layer. Links use the target's bottom edge and canvas-pixel spacing. Hidden linked layers collapse their height and incoming gap. Independent layers keep absolute positions. Choose **Independent position** to remove a link; a missing target or circular chain keeps the authored position. This is vertical flow, not a full container layout system.

## Reuse layers

Select layers and use **⌘/Ctrl+C**, then **⌘/Ctrl+V** in another template in the same dashboard tab. Paste creates new layer and group IDs, remaps links between copied layers, and avoids API-parameter key collisions. Source image URLs are retained. Clipboard contents last for the current dashboard session; ordinary text inputs keep normal text copy/paste.

## Production advice

- Use stable names for layers that API clients modify.
- Keep layout rules in the template instead of rebuilding layout in application code.
- Test templates in the playground before connecting production jobs.
