Receipt Image template
The receipt-image template renders a business image as a PNG. POST a JSON payload to the endpoint below and you receive a CDN URL in the response.
Endpoint
POST https://html2img.com/api/v1/templates/receipt-image
X-API-Key: <your-api-key>
Content-Type: application/json
Authentication uses the X-API-Key header. See the
authentication docs
for details on issuing and rotating keys.
Inputs
The full set of inputs the template accepts:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
business_name | string | Yes | Text value for the business name. | Studio Ink |
logo_url | url | No | URL of the logo to include in the rendered image. | — |
order_number | string | Yes | Text value for the order number. | #A8421-9032 |
order_date | string | No | Text value for the order date. | Apr 30, 2026 |
customer_name | string | No | Text value for the customer name. | Jamie Park |
customer_email | string | No | Text value for the customer email. | [email protected] |
items | array of objects | Yes | Array of items entries. See the array shape section below. | [{"name":"Botanical print, A2","qty":"2","amount":"$58.00"},{"name":"Hand-bound notebook","qty":"1","amount":"$24.00"},{"name":"Letterpress card pack","qty":"3","amount":"$36.00"}] |
subtotal | string | No | Text value for the subtotal. | $118.00 |
shipping | string | No | Text value for the shipping. | $8.00 |
tax_amount | string | No | Text value for the tax amount. | $10.40 |
total | string | Yes | Text value for the total. | $136.40 |
thank_you_message | string | No | Text value for the thank you message. | Thanks for supporting independent makers. |
accent_color | string | No | Hex colour code for the accent. | #B45309 |
Array shapes
items accepts an array of objects with the following fields:
name(string)qty(string)amount(string)
Defaults
Defaults applied automatically when not overridden in the request:
| Option | Default value |
|---|---|
width | 800 |
height | 1200 |
Code examples
curl -X POST https://app.html2img.com/api/v1/templates/receipt-image \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"business_name":"Studio Ink","order_number":"#A8421-9032","order_date":"Apr 30, 2026","customer_name":"Jamie Park","customer_email":"[email protected]","items":[{"name":"Botanical print, A2","qty":"2","amount":"$58.00"},{"name":"Hand-bound notebook","qty":"1","amount":"$24.00"},{"name":"Letterpress card pack","qty":"3","amount":"$36.00"}],"subtotal":"$118.00","shipping":"$8.00","tax_amount":"$10.40","total":"$136.40","thank_you_message":"Thanks for supporting independent makers.","accent_color":"#B45309"}' <?php
$response = \Illuminate\Support\Facades\Http::withHeaders([
'X-API-Key' => 'YOUR_API_KEY',
])->post('https://app.html2img.com/api/v1/templates/receipt-image', ['business_name' => 'Studio Ink', 'order_number' => '#A8421-9032', 'order_date' => 'Apr 30, 2026', 'customer_name' => 'Jamie Park', 'customer_email' => '[email protected]', 'items' => ['0' => ['name' => 'Botanical print, A2', 'qty' => '2', 'amount' => '$58.00'], '1' => ['name' => 'Hand-bound notebook', 'qty' => '1', 'amount' => '$24.00'], '2' => ['name' => 'Letterpress card pack', 'qty' => '3', 'amount' => '$36.00']], 'subtotal' => '$118.00', 'shipping' => '$8.00', 'tax_amount' => '$10.40', 'total' => '$136.40', 'thank_you_message' => 'Thanks for supporting independent makers.', 'accent_color' => '#B45309']);
$url = $response->json('url'); const response = await fetch('https://app.html2img.com/api/v1/templates/receipt-image', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"business_name": "Studio Ink",
"order_number": "#A8421-9032",
"order_date": "Apr 30, 2026",
"customer_name": "Jamie Park",
"customer_email": "[email protected]",
"items": [
{
"name": "Botanical print, A2",
"qty": "2",
"amount": "$58.00"
},
{
"name": "Hand-bound notebook",
"qty": "1",
"amount": "$24.00"
},
{
"name": "Letterpress card pack",
"qty": "3",
"amount": "$36.00"
}
],
"subtotal": "$118.00",
"shipping": "$8.00",
"tax_amount": "$10.40",
"total": "$136.40",
"thank_you_message": "Thanks for supporting independent makers.",
"accent_color": "#B45309"
}),
});
const { url } = await response.json(); import requests
response = requests.post(
'https://app.html2img.com/api/v1/templates/receipt-image',
headers={'X-API-Key': 'YOUR_API_KEY'},
json={'business_name': 'Studio Ink', 'order_number': '#A8421-9032', 'order_date': 'Apr 30, 2026', 'customer_name': 'Jamie Park', 'customer_email': '[email protected]', 'items': {'0': {'name': 'Botanical print, A2', 'qty': '2', 'amount': '$58.00'}, '1': {'name': 'Hand-bound notebook', 'qty': '1', 'amount': '$24.00'}, '2': {'name': 'Letterpress card pack', 'qty': '3', 'amount': '$36.00'}}, 'subtotal': '$118.00', 'shipping': '$8.00', 'tax_amount': '$10.40', 'total': '$136.40', 'thank_you_message': 'Thanks for supporting independent makers.', 'accent_color': '#B45309'},
)
url = response.json()['url'] Looking for a fuller integration sketch in your language? The usage guides cover PHP, Laravel, Rails, Python, JavaScript, React and Vue.
Response
A successful render returns:
{
"success": true,
"id": "abc123",
"url": "https://i.html2img.com/abc123.png",
"credits_remaining": 1234,
"template": "receipt-image"
}
The url field is a CDN URL for the rendered PNG. credits_remaining tracks your monthly quota. Shared response fields are documented in the
API parameters reference.
Errors
The template endpoint returns the following error responses:
422 Validation failed
Returned when one or more inputs fail validation. The errors object lists field-specific messages.
{
"success": false,
"error": "validation_failed",
"errors": {
"title": ["The title field is required."]
}
} 404 Template not found
Returned with {"code": "template_not_found"} if the slug is not registered. Check the template list for current slugs.
401 Unauthorised
Missing or invalid API key. See the authentication docs.
429 Too many requests
You have hit the rate limit or used your monthly credits. The pricing page covers higher-volume plans.
Related templates
- Invoice Image — Render full invoices as PNG images for emails, dashboards, and exports
- Event Ticket — Print- and email-ready tickets with QR/barcode slot and perforated stub
- Product Card — E-commerce product cards with price, optional sale price, and CTA
See the Receipt Image template in our gallery for sample renders and use cases.