IMAGE
banner
1200×400px
Sale / Promotion Banner
Wide promotional banner with discount percentage, product name, deadline, and promo code.
Use Cases
- Black Friday and seasonal sale banners
- Flash sale promotions
- Newsletter header banners
- E-commerce website hero banners
Tags
sale
promotion
discount
banner
ecommerce
coupon
promo-code
1200x400
Template Variables
| Variable | Type | Default | Description |
|---|---|---|---|
| discount | string | 30% OFF | Discount amount or offer headline |
| product | string | Everything in the store | What the offer applies to |
| deadline | string | Ends Sunday | Offer deadline text |
| code | string | SAVE30 | Promo code (leave blank to omit) |
| bg_color | color | #dc2626 | Banner background colour |
| text_color | color | #ffffff | Text colour |
| code_bg_color | color | #7f1d1d | Promo code badge background colour |
API Example
POST to
https://image.toolkitapi.io/v1/image/from-template
with your template URL and variable values.
curl -X POST "https://image.toolkitapi.io/v1/image/from-template" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"template_url": "https://toolkitapi.io/static/templates/image/banner-sale.html", "variables": {"discount": "30% OFF", "product": "Everything in the store", "deadline": "Ends Sunday", "code": "SAVE30", "bg_color": "#dc2626", "text_color": "#ffffff", "code_bg_color": "#7f1d1d"}, "width": 1200, "height": 400, "format": "png"}'
import httpx, base64
resp = httpx.post(
"https://image.toolkitapi.io/v1/image/from-template",
headers={"X-API-Key": "YOUR_API_KEY"},
json={
"template_url": "https://toolkitapi.io/static/templates/image/banner-sale.html",
"variables": {
"discount": "30% OFF",
"product": "Everything in the store",
"deadline": "Ends Sunday",
"code": "SAVE30",
"bg_color": "#dc2626",
"text_color": "#ffffff",
"code_bg_color": "#7f1d1d"
},
"width": 1200,
"height": 400,
"format": "png"
},
)
image_bytes = base64.b64decode(resp.json()["image"])
with open("result.png", "wb") as f:
f.write(image_bytes)
const response = await fetch("https://image.toolkitapi.io/v1/image/from-template", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"template_url": "https://toolkitapi.io/static/templates/image/banner-sale.html",
"variables": {
"discount": "30% OFF",
"product": "Everything in the store",
"deadline": "Ends Sunday",
"code": "SAVE30",
"bg_color": "#dc2626",
"text_color": "#ffffff",
"code_bg_color": "#7f1d1d"
},
"width": 1200,
"height": 400,
"format": "png"
}),
});
const data = await response.json();
// data.image is a base64-encoded PNG
$body = @{
template_url = "https://toolkitapi.io/static/templates/image/banner-sale.html"
variables = {
"discount": "30% OFF",
"product": "Everything in the store",
"deadline": "Ends Sunday",
"code": "SAVE30",
"bg_color": "#dc2626",
"text_color": "#ffffff",
"code_bg_color": "#7f1d1d"
}
width = 1200
height = 400
format = "png"
} | ConvertTo-Json -Depth 5
Invoke-RestMethod -Method POST `
-Uri "https://image.toolkitapi.io/v1/image/from-template" `
-Headers @{"X-API-Key" = "YOUR_API_KEY"} `
-ContentType "application/json" `
-Body $body