Invoice Image template
The invoice-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/invoice-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 |
|---|---|---|---|---|
invoice_number | string | Yes | Text value for the invoice number. | INV-2026-0042 |
issue_date | string | No | Text value for the issue date. | Apr 30, 2026 |
due_date | string | No | Text value for the due date. | May 30, 2026 |
business_name | string | Yes | Text value for the business name. | Northwind Studio Ltd |
business_address | string | No | Text value for the business address. | 12 Bishopsgate
London EC2N 4AT
United Kingdom |
business_email | string | No | Text value for the business email. | [email protected] |
client_name | string | Yes | Text value for the client name. | Acme Corp |
client_address | string | No | Text value for the client address. | 548 Market Street
San Francisco, CA 94104
USA |
client_email | string | No | Text value for the client email. | [email protected] |
items | array of objects | Yes | Array of items entries. See the array shape section below. | [{"description":"Brand identity design","quantity":"1","unit_price":"$4,800.00","amount":"$4,800.00"},{"description":"Landing page build (8 sections)","quantity":"1","unit_price":"$3,200.00","amount":"$3,200.00"},{"description":"Photography retainer","quantity":"6","unit_price":"$420.00","amount":"$2,520.00"}] |
subtotal | string | No | Text value for the subtotal. | $10,520.00 |
tax_label | string | No | Text value for the tax label. | VAT (20%) |
tax_amount | string | No | Text value for the tax amount. | $2,104.00 |
total | string | Yes | Text value for the total. | $12,624.00 |
notes | string | No | Text value for the notes. | Payment due within 30 days. Wire transfer details on file. |
logo_url | url | No | URL of the logo to include in the rendered image. | — |
accent_color | string | No | Hex colour code for the accent. | #0F766E |
Array shapes
items accepts an array of objects with the following fields:
description(string)quantity(string)unit_price(string)amount(string)
Defaults
Defaults applied automatically when not overridden in the request:
| Option | Default value |
|---|---|
width | 1240 |
height | 1754 |
Code examples
curl -X POST https://app.html2img.com/api/v1/templates/invoice-image \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"invoice_number":"INV-2026-0042","issue_date":"Apr 30, 2026","due_date":"May 30, 2026","business_name":"Northwind Studio Ltd","business_address":"12 Bishopsgate\nLondon EC2N 4AT\nUnited Kingdom","business_email":"[email protected]","client_name":"Acme Corp","client_address":"548 Market Street\nSan Francisco, CA 94104\nUSA","client_email":"[email protected]","items":[{"description":"Brand identity design","quantity":"1","unit_price":"$4,800.00","amount":"$4,800.00"},{"description":"Landing page build (8 sections)","quantity":"1","unit_price":"$3,200.00","amount":"$3,200.00"},{"description":"Photography retainer","quantity":"6","unit_price":"$420.00","amount":"$2,520.00"}],"subtotal":"$10,520.00","tax_label":"VAT (20%)","tax_amount":"$2,104.00","total":"$12,624.00","notes":"Payment due within 30 days. Wire transfer details on file.","accent_color":"#0F766E"}' <?php
$response = \Illuminate\Support\Facades\Http::withHeaders([
'X-API-Key' => 'YOUR_API_KEY',
])->post('https://app.html2img.com/api/v1/templates/invoice-image', ['invoice_number' => 'INV-2026-0042', 'issue_date' => 'Apr 30, 2026', 'due_date' => 'May 30, 2026', 'business_name' => 'Northwind Studio Ltd', 'business_address' => '12 Bishopsgate
London EC2N 4AT
United Kingdom', 'business_email' => '[email protected]', 'client_name' => 'Acme Corp', 'client_address' => '548 Market Street
San Francisco, CA 94104
USA', 'client_email' => '[email protected]', 'items' => ['0' => ['description' => 'Brand identity design', 'quantity' => '1', 'unit_price' => '$4,800.00', 'amount' => '$4,800.00'], '1' => ['description' => 'Landing page build (8 sections)', 'quantity' => '1', 'unit_price' => '$3,200.00', 'amount' => '$3,200.00'], '2' => ['description' => 'Photography retainer', 'quantity' => '6', 'unit_price' => '$420.00', 'amount' => '$2,520.00']], 'subtotal' => '$10,520.00', 'tax_label' => 'VAT (20%)', 'tax_amount' => '$2,104.00', 'total' => '$12,624.00', 'notes' => 'Payment due within 30 days. Wire transfer details on file.', 'accent_color' => '#0F766E']);
$url = $response->json('url'); const response = await fetch('https://app.html2img.com/api/v1/templates/invoice-image', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"invoice_number": "INV-2026-0042",
"issue_date": "Apr 30, 2026",
"due_date": "May 30, 2026",
"business_name": "Northwind Studio Ltd",
"business_address": "12 Bishopsgate\nLondon EC2N 4AT\nUnited Kingdom",
"business_email": "[email protected]",
"client_name": "Acme Corp",
"client_address": "548 Market Street\nSan Francisco, CA 94104\nUSA",
"client_email": "[email protected]",
"items": [
{
"description": "Brand identity design",
"quantity": "1",
"unit_price": "$4,800.00",
"amount": "$4,800.00"
},
{
"description": "Landing page build (8 sections)",
"quantity": "1",
"unit_price": "$3,200.00",
"amount": "$3,200.00"
},
{
"description": "Photography retainer",
"quantity": "6",
"unit_price": "$420.00",
"amount": "$2,520.00"
}
],
"subtotal": "$10,520.00",
"tax_label": "VAT (20%)",
"tax_amount": "$2,104.00",
"total": "$12,624.00",
"notes": "Payment due within 30 days. Wire transfer details on file.",
"accent_color": "#0F766E"
}),
});
const { url } = await response.json(); import requests
response = requests.post(
'https://app.html2img.com/api/v1/templates/invoice-image',
headers={'X-API-Key': 'YOUR_API_KEY'},
json={'invoice_number': 'INV-2026-0042', 'issue_date': 'Apr 30, 2026', 'due_date': 'May 30, 2026', 'business_name': 'Northwind Studio Ltd', 'business_address': '12 Bishopsgate
London EC2N 4AT
United Kingdom', 'business_email': 'billing@northwind.studio', 'client_name': 'Acme Corp', 'client_address': '548 Market Street
San Francisco, CA 94104
USA', 'client_email': 'ap@acme.com', 'items': {'0': {'description': 'Brand identity design', 'quantity': '1', 'unit_price': '$4,800.00', 'amount': '$4,800.00'}, '1': {'description': 'Landing page build (8 sections)', 'quantity': '1', 'unit_price': '$3,200.00', 'amount': '$3,200.00'}, '2': {'description': 'Photography retainer', 'quantity': '6', 'unit_price': '$420.00', 'amount': '$2,520.00'}}, 'subtotal': '$10,520.00', 'tax_label': 'VAT (20%)', 'tax_amount': '$2,104.00', 'total': '$12,624.00', 'notes': 'Payment due within 30 days. Wire transfer details on file.', 'accent_color': '#0F766E'},
)
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": "invoice-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
- Event Ticket — Print- and email-ready tickets with QR/barcode slot and perforated stub
- Receipt Image — Compact order receipts for confirmation emails and thank-you screens
- Product Card — E-commerce product cards with price, optional sale price, and CTA
See the Invoice Image template in our gallery for sample renders and use cases.