Everything you need to generate invoice PDFs
All API requests require an API key. Include it in the X-API-Key header:
X-API-Key: your_api_key
Don't have an API key? Get one for free.
https://pdfbill.io/api/v1
Generate an invoice PDF from JSON data.
| Header | Value |
|---|---|
X-API-Key |
Your API key required |
Content-Type |
application/json |
| Field | Type | Description |
|---|---|---|
template |
string | optional Template style: modern, classic, or minimal. Default: modern |
invoice_number |
string | optional Invoice number. Default: INV-001 |
date |
string | optional Issue date (YYYY-MM-DD). Default: today |
due_date |
string | optional Due date (YYYY-MM-DD) |
from |
object | optional Sender information |
from.name |
string | Company/person name |
from.address |
string | Address |
from.email |
string | Email address |
to |
object | optional Recipient information |
to.name |
string | Company/person name |
to.address |
string | Address |
to.email |
string | Email address |
items |
array | required Line items |
items[].description |
string | Item description |
items[].quantity |
number | Quantity |
items[].price |
number | Unit price |
tax_rate |
number | optional Tax rate as percentage (e.g., 10 for 10%) |
currency |
string | optional Currency symbol. Default: $ |
notes |
string | optional Additional notes |
curl -X POST https://pdfbill.io/api/v1/invoice \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"template": "modern",
"invoice_number": "INV-2025-001",
"date": "2025-12-01",
"due_date": "2025-12-15",
"from": {
"name": "Your Company",
"address": "123 Main St, City, Country",
"email": "billing@yourcompany.com"
},
"to": {
"name": "Client Company",
"address": "456 Client Ave, City, Country",
"email": "accounts@client.com"
},
"items": [
{"description": "Web Development", "quantity": 10, "price": 150},
{"description": "Hosting (Monthly)", "quantity": 1, "price": 29}
],
"tax_rate": 10,
"currency": "$",
"notes": "Payment due within 14 days."
}' \
-o invoice.pdf
Returns the PDF file as binary data with:
| Header | Value |
|---|---|
Content-Type |
application/pdf |
Content-Disposition |
attachment; filename="invoice.pdf" |
| Status Code | Description |
|---|---|
400 |
Bad request - Invalid input data or unknown template |
401 |
Unauthorized - Missing or invalid API key |
500 |
Server error - Something went wrong |
{
"error": "Error message here"
}
Choose a template style by setting the template field:
| Template | Description |
|---|---|
modern |
Clean, professional design with blue accents. Great for tech companies. |
classic |
Traditional, formal design with serif fonts. Perfect for enterprises. |
minimal |
Simple, elegant design with lots of whitespace. Ideal for startups. |
| Plan | Invoices per Month |
|---|---|
| Free | 50 |
| Starter ($9/mo) | 500 |
| Pro ($29/mo) | 2,000 |
const fs = require('fs');
const response = await fetch('https://pdfbill.io/api/v1/invoice', {
method: 'POST',
headers: {
'X-API-Key': 'your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
template: 'modern',
invoice_number: 'INV-001',
from: { name: 'Your Company' },
to: { name: 'Client' },
items: [{ description: 'Service', quantity: 1, price: 100 }]
})
});
const buffer = await response.arrayBuffer();
fs.writeFileSync('invoice.pdf', Buffer.from(buffer));
import requests
response = requests.post(
'https://pdfbill.io/api/v1/invoice',
headers={
'X-API-Key': 'your_api_key',
'Content-Type': 'application/json',
},
json={
'template': 'modern',
'invoice_number': 'INV-001',
'from': {'name': 'Your Company'},
'to': {'name': 'Client'},
'items': [{'description': 'Service', 'quantity': 1, 'price': 100}]
}
)
with open('invoice.pdf', 'wb') as f:
f.write(response.content)
$ch = curl_init('https://pdfbill.io/api/v1/invoice');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-Key: your_api_key',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'template' => 'modern',
'invoice_number' => 'INV-001',
'from' => ['name' => 'Your Company'],
'to' => ['name' => 'Client'],
'items' => [['description' => 'Service', 'quantity' => 1, 'price' => 100]]
])
]);
$pdf = curl_exec($ch);
file_put_contents('invoice.pdf', $pdf);
Contact us at hello@pdfbill.io