Blog / API, MCP & agents

How template-based image generation APIs work

How a template-based image generation API turns a design and your data into images, and the six render checks that show whether its output holds up.

Remy LemeunierVP Eng & Co-founder11 min read
Published
Updated
A JSON elements request with headline, price and photo next to the Kinetic RUN THE TRAIL. 1200 × 628 image it produced, a headline layer label above it

A template-based image generation API turns reusable visual layouts and structured data into visual assets. Unlike prompt-based image APIs, it renders variable content inside a design made in advance, so the thousandth image looks like the first.

Render speed depends on the inputs. Heavy source images slow a render, and an external image is downloaded during the render unless the API has cached it. So host images on a CDN and size them to their box.

What is a template-based image generation API?

A template-based image generation API fills the named layers of a design with your data and returns the rendered file. The design holds everything that should not change: layout, fonts, colors, logo, sizes. The request carries only what changes: a headline, a price, a photo URL. That is programmatic image generation with the design kept out of the code, which is why these tools are also called image automation APIs.

Three kinds of API make images from code, and they answer different jobs:

  • Template-based: your data goes into a fixed design made in advance.
  • Prompt-based (text-to-image): a model draws a new picture from a description. Good for scenes and concepts; it cannot promise a font, an exact color or an ad size.
  • HTML screenshot: your own HTML and CSS rendered in a headless browser. You own the layout code and the browser that runs it.

The first two combine well: a model makes the photo, the template places it. We tested that split in how to keep AI-generated ads on brand.

Teams use template APIs wherever the same visual repeats with new data: Open Graph images for every page, product ads from a catalog, email headers with the reader’s name, certificates and badges, and one campaign resized for every placement.

How a render works

A render starts before any request: someone designs the template and names its layers. In the example below, an Abyssale Design for Kinetic, a fictional sportswear brand, the layers are headline, price, photo, cta and logo. Those names are the contract between the design and your code.

The lifecycle of a render: the Kinetic Design and its named layers, the request with elements, then validation, image fetch, text fitting, one raster per format and storage, ending in the file URL for a synchronous call or a webhook for an asynchronous one
One render, step by step. The layer names in the request match the layers of the Design.

When the request arrives, the renderer works through five steps:

  1. Validate. Every key in the request is matched to a layer of that name.
  2. Fetch the images. Each image sent as a URL is downloaded.
  3. Fit the text. Each text goes into its box. A longer line shrinks within the limits the layer sets, or the call is refused.
  4. Rasterize each format. Each size is drawn with its own layout, the landscape at 1200 × 628 here.
  5. Store and return. The file is stored on a CDN, and its URL comes back in the response, or in a webhook.

The example below renders Kinetic’s landscape ad server-side, on Abyssale’s synchronous endpoint. It waits for the render and returns the file’s URL in file.cdn_url; layers the request leaves out, such as the logo and the button, keep the Design’s defaults.

  1. import abyssale from '@abyssale/sdk'; // npm install @abyssale/sdk
  2. const { data, error } = await abyssale.generateImage('{designId}', {
  3. template_format_name: 'landscape',
  4. elements: {
  5. headline: { payload: 'RUN THE TRAIL.' },
  6. price: { payload: '$140' },
  7. photo: { image_url: 'https://cdn.kinetic.example/trail-max.jpg' },
  8. },
  9. });
  10. if (error) console.error(error);
  11. else console.log(data.file.cdn_url);
  1. from abyssale import Abyssale # pip install abyssale
  2. with Abyssale() as client:
  3. image = client.generate_image("{designId}", {
  4. "template_format_name": "landscape",
  5. "elements": {
  6. "headline": {"payload": "RUN THE TRAIL."},
  7. "price": {"payload": "$140"},
  8. "photo": {"image_url": "https://cdn.kinetic.example/trail-max.jpg"},
  9. },
  10. })
  11. print(image.file.cdn_url)
  1. curl -X POST https://api.abyssale.com/banner-builder/{designId}/generate \
  2. -H "x-api-key: $ABYSSALE_API_KEY" \
  3. -H "Content-Type: application/json" \
  4. -d '{
  5. "template_format_name": "landscape",
  6. "elements": {
  7. "headline": { "payload": "RUN THE TRAIL." },
  8. "price": { "payload": "$140" },
  9. "photo": { "image_url": "https://cdn.kinetic.example/trail-max.jpg" }
  10. }
  11. }'

Pick the call by who is waiting for the file. A synchronous call returns one image to someone waiting for it, capped at 28 seconds on our API. An asynchronous call queues the work, renders every size or a whole catalog, and reports back by webhook or polling. Running those calls at volume, with webhooks and retries, is covered in how to run an image generation API in production.

A render link puts the layer values in a URL, so an image tag in a page or an email renders on its first open. How APIs differ on these routes, and on SDKs, outputs, limits and pricing, is in creative automation platforms with an API compared.

What decides whether the output holds up

Every template API fills layers with data. What separates them is the render: whether the file still looks like the design when the data is long, the size is narrow, the font is your own and the photo is heavy. Check these six points in the documentation, then prove each one with your own worst data.

One layout per size

A template API should give each size its own layout. A campaign needs the same ad in four to ten sizes and aspect ratios, and a 300 × 600 half page cannot be a shrunk 1200 × 628 landscape. Some APIs keep every size in one template and render every aspect ratio in a single request; others take one size per request, so each size is a template to maintain.

The Kinetic Design rendered in four formats by one asynchronous call: landscape 1200 × 628 with the copy at left and the shoe at right, square 1080 × 1080, half page 300 × 600 and story 1080 × 1920 with the shoe on top and the copy below
One asynchronous call, four formats, the same data. Each format places the shoe, the headline and the button in its own layout.

In Abyssale, a Design holds its formats, and an asynchronous call without template_format_names renders all of them. A new size is laid out once, by auto layout at no cost or by AI-powered layout. Done when: your smallest and your largest size come from the same request and both read well.

Text that does not fit

A text layer should either fit a long line or refuse it, never cut it silently. Facing a line longer than its box, a layer can shrink it down to a floor, cap the number of lines, or refuse the call.

In Abyssale, auto_resize shrinks the text, min_font_size sets the floor, max_lines the cap and text_truncation ends a cut line with an ellipsis (text properties). AI-powered formats, which do not shrink text, refuse a line that cannot fit with The text … cannot fit within the defined space.

We sent the Kinetic half page an 89-character headline instead of RUN THE TRAIL.. The text shrank and wrapped to five lines, still readable.

Kinetic 300 × 600 half page with RUN THE TRAIL. on two lines
300×600
Kinetic 300 × 600 half page with the headline The lightest trail shoe we have ever built, now with a grippier outsole for wet rock days on five lines
300×600
The Kinetic half page with its default headline, then with the 89-character one, shrunk to five lines above the price.

Whether five lines is acceptable is a design decision, so make it in the template. Done when: the longest text in your data, sent to the smallest size, reads at arm’s length or is refused with an error your code handles.

Custom and variable fonts

A template API should render your brand font, every weight of it, in every alphabet you publish in. Check which font files it takes and how a request picks a weight. For a variable font, one file holding every weight, check whether its named styles show up as weights.

Done when: your brand font renders in every weight and alphabet you use, without a fallback.

Image inputs and cache

A template API should download each image once and accept small images inline.

On our API, a typical render takes under a second, and heavy source images are what push a call toward its 28-second cap (synchronous generation). The renderer downloads every image URL during the render, so a slow image host slows the call. An API that caches the images it has already fetched downloads a logo or a product photo once, however many variants use it; Abyssale does.

Weight and size matter both ways. A 20 MB photo placed in a 300 × 600 box is mostly downloaded for nothing, so resize sources to about the largest box they fill; a source smaller than its box comes out soft. A base64 image travels inside the request, which suits small images made on the fly, such as a chart or a QR code.

Abyssale takes an image URL up to 20 MB, in JPEG, PNG, WebP, SVG or AVIF, or a base64 image as image_encoded (image properties). An image that cannot be fetched fails that render with cannot_build_banner. Done when: a broken and a slow image URL each give a result your code logs.

The same file every time

The same request should give the same file. A render that drifts between runs makes every approval worthless. In our November 2026 tests for keeping AI-generated ads on brand, the 300 × 250 came back byte for byte identical on three renders of the same request.

The file type and the compression level then set sharpness against weight, and a JPEG has no transparency, so a transparent design goes out as PNG. Done when: the same request rendered twice gives the same file, and the first render has been checked against the design before the batch is approved.

Template changes

A designer should be able to change the template without a deploy, and a broken layer name should never pass unnoticed. Because the code addresses layers by name, colors, layout and sizes can change freely, but a renamed layer or a misspelled property breaks the link quietly.

Abyssale ignores properties it does not know, so paylod instead of payload leaves the layer on its default without an error; a layer marked mandatory and left out does stop the call. Done when: your code checks layer names against GET /designs/{designId} before it sends, and a call without a mandatory layer is refused.

Template-based image generation tools with API access

Nine template-based image generation tools with API access differ on three of these render checks: several sizes per call, text fitting and fonts. Abyssale wrote this comparison.

Every cell comes from each vendor’s own documentation, read on 25 November 2026. The list is alphabetical and unranked. ✓ means documented and ~ partly. ✗ means the docs say no, or that the request takes one size. – means we did not find it in the documentation, which does not prove the feature is missing.

API Several sizes per call Text fitting Fonts
Abyssale shrinks to a floor or caps lines; AI-powered formats refuse TTF, OTF; variable fonts
APITemplate.io – –
Bannerbear fit and resize options OTF, WOFF, WOFF2
Creatomate – minimum and maximum font size OTF, TTF, WOFF; no variable fonts
Orshot fit, truncate or flow, set in the template TTF, OTF, WOFF, WOFF2; variable fonts
Pixelixe automatic font size upload, formats not documented
Placid fit, clamp or single line, set in the template TTF, OTF, WOFF, WOFF2
RenderForm – auto-fit in the editor TTF
Templated autofit, minimum and maximum font size TTF, OTF, WOFF, WOFF2

What sits behind the marks:

  • Several sizes per call. Orshot adds up to 50 extra sizes to one render4, and Pixelixe renders every format of a Design Set5. Templated takes several templates in one call8. Bannerbear batches up to 100 payloads, one size each2. APITemplate.io1 and Placid6 render one size per request.
  • Text fitting. In Orshot and Placid, the behavior is a template setting rather than a request parameter. Creatomate3 and Templated8 take a minimum and a maximum font size. RenderForm documents auto-fit in its editor; its API reference lists no text-fit parameter7.
  • Fonts. Eight of the nine take your own font files, in formats from TTF only (RenderForm)7 to TTF, OTF, WOFF and WOFF2 (Placid, Templated)68; APITemplate.io documents no font upload. For variable fonts, Orshot reads the weight axis across its whole range4, and Creatomate states they are not supported, one file being one static font3.

For delivery, webhooks, SDKs, outputs, rate limits and pricing, see creative automation platforms with an API compared, which covers 13 platforms.

Sources · Read on 25 November 2026

  1. APITemplate.io, API reference v2 and REST API integration guide: apitemplate.io/apiv2, apitemplate.io/docs/integrations/rest-api
  2. Bannerbear, API reference: developers.bannerbear.com
  3. Creatomate, API reference (create a render, webhooks, text element, custom fonts): creatomate.com/docs/api/reference/create-a-render, creatomate.com/llms-full.txt
  4. Orshot, API reference and docs (render from template, async render, dynamic URLs, text modes, SDKs, custom fonts): orshot.com/docs
  5. Pixelixe, API documentation v2: pixelixe.com/docs/v2
  6. Placid, REST and URL API documentation (images, layers, fonts, rate limit, URL generation): placid.app/docs/2.0
  7. RenderForm, API docs (render image, template properties, custom fonts, signed requests): renderform.io/docs
  8. Templated, API reference (create a render, upload fonts): templated.io/docs/renders/create, templated.io/docs/fonts/upload
  9. Satori, README: github.com/vercel/satori

Building it yourself instead

Some teams render images themselves with a headless browser, an HTML-to-SVG library or a canvas. Each one works, and each one makes you own part of what a template API does:

  • Headless browser (Puppeteer, Playwright): you own a browser in production, its memory, its start-up time and its fonts.
  • Satori and similar HTML-to-SVG libraries: fast, but they support only part of CSS, so layouts are written within those limits9.
  • Canvas drawing: full control, and every layout is code. Text wrapping and fitting are yours to write.

In all three, the design lives in code, so a new layout or a new size waits for a developer. A template API moves the design to a file a designer edits, and the code sends only data. For the decision itself, costs and team included, see Abyssale for developers.

To try the render described here, create a Design with named layers, send it one row of your real data, then the longest row. The Abyssale API is on the Pro plan and above, and the 14-day trial includes it. The same Designs also fill without code: from a spreadsheet, from Make, Zapier or n8n, or from Claude and ChatGPT through the Abyssale MCP server.

Share this article