USE CASE
MARKETING

Generate Ad Variations From a Spreadsheet

One template, a list of headlines and discounts, and you have 50 ad images in a single API call. No design queue.

OUTPUT PREVIEW
SCALE 1:1
Flash Sale
70% OFF
Limited time only — don't miss out
Shop Now
Ends in 24 hours
Template + variables = image. That's the whole flow.RENDERED
SECTION 01

50 Banner Variants, One Designer

You need ad variations for different segments: different headlines, discount amounts, product images. Your designer is booked for two weeks. The campaign launches late.

Canva and Figma are great for one-off designs. But when you need 50 variants with different copy per region or audience, manual tools are the wrong fit.

SECTION 02

Loop Over Your Data, Get Images

Build one ad template with variables for headline, discount, urgency text, product image. Mint URLs in batch by looping over your campaign data.

POST /v1/urls takes up to 25 items per request. Each URL renders a unique ad image. Download them or feed the URLs directly to your ad platform.

SECTION 03

Example

FIG. 02
ad-batch.ts
ad-batch.ts
Shell
1// Generate 3 flash sale variations for different segments2const segments = [3  { discount: "70% OFF", headline: "FLASH SALE", urgency: "Ends in 2 hours" },4  { discount: "50% OFF", headline: "WEEKEND DEAL", urgency: "Ends Sunday" },5  { discount: "BUY 1 GET 1", headline: "BOGO SALE", urgency: "Today only" },6];78const res = await fetch("https://api.htmlpix.com/v1/urls", {9  method: "POST",10  headers: {11    Authorization: `Bearer ${process.env.HTMLPIX_KEY}`,12    "Content-Type": "application/json",13  },14  body: JSON.stringify({15    items: segments.map((s) => ({16      templateId: FLASH_SALE_TEMPLATE_ID,17      variables: {18        discount: s.discount,19        headline: s.headline,20        subtext: "Limited time — don't miss out",21        cta: "SHOP NOW",22        urgency: s.urgency,23      },24      width: 1200,25      height: 630,26    })),27  }),28});2930const { urls } = await res.json();31// urls[0].url, urls[1].url, urls[2].url — ready for ad platforms
Copy, paste, run. That's it.READY TO RUN
SECTION 04

Integration Snippets

lib/adCreatives.ts
TypeScript
interface AdVariation {
  discount: string;
  headline: string;
  subtext: string;
  urgency: string;
}

export async function generateAdBatch(variations: AdVariation[]) {
  const res = await fetch("https://api.htmlpix.com/v1/urls", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.HTMLPIX_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      items: variations.map((v) => ({
        templateId: process.env.FLASH_SALE_TEMPLATE_ID,
        variables: { ...v, cta: "SHOP NOW" },
        width: 1200,
        height: 630,
      })),
    }),
  });

  const { urls } = await res.json();
  return urls.map((u: any) => u.url);
}
SECTION 05

Time & Cost Savings

Without HTMLPix

Designer makes each variant by hand. 30-60 minutes each. 50 variants = a full week of design work. Campaign waits.

With HTMLPix

One template, batch-mint with different copy. 50 variants in one API call. Campaign ships today.

Estimated Savings
Days of design time
SECTION 06

Why HTMLPix

01

Skip the Design Queue

Generate 50 variants from one template. Different headlines, discounts, and images per audience. No Figma, no back-and-forth.

02

Data-Driven Copy

Pull current prices, inventory counts, or testimonial text from your database. The template renders with live data.

03

Easy A/B Testing

Mint multiple headline or offer variations. Test which ones perform. Swap the variables and re-render.

04

Any Dimension

Render the same template at different sizes: Facebook (1200x628), Instagram Stories (1080x1920), LinkedIn (1200x627). Pass width and height per item.

SECTION 07

Frequently Asked Questions

Try It

500 images per month on Starter. Generate your first batch of ad variations.

Get Your API Key