One template, a list of headlines and discounts, and you have 50 ad images in a single API call. No design queue.
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.
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.
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 platformsinterface 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);
}Designer makes each variant by hand. 30-60 minutes each. 50 variants = a full week of design work. Campaign waits.
One template, batch-mint with different copy. 50 variants in one API call. Campaign ships today.
Generate 50 variants from one template. Different headlines, discounts, and images per audience. No Figma, no back-and-forth.
Pull current prices, inventory counts, or testimonial text from your database. The template renders with live data.
Mint multiple headline or offer variations. Test which ones perform. Swap the variables and re-render.
Render the same template at different sizes: Facebook (1200x628), Instagram Stories (1080x1920), LinkedIn (1200x627). Pass width and height per item.
A unique social preview for every page on your site. One template, one API call.
Personalized stats, dashboards, and banners rendered as images. Works in every email client.
Badges, year-in-review cards, and certificates your users can post on social media.
Post your key metrics to Slack or email as a clean dashboard image. Runs on a cron job.
Just migrated our OG images to @htmlpix. Should have done this months ago.
Show customer quotes on your site as styled cards. No embed scripts, no API keys.
Branded product cards generated from your database. For social, email, and marketplaces.