API v1
Invoice API documentation
The API is free, anonymous and stateless from the document user's perspective. There are no API keys or account requirements in Phase 2. Rate-limit counters are stored separately from invoice payloads.
POST/api/v1/invoices/pdf
Accepts invoice JSON and returns a real PDF response with Content-Type: application/pdf. The API renderer is intentionally simple and server-safe; browser-generated PDFs remain the richer visual path.
curl -X POST \ -H 'Content-Type: application/json' \ --data @invoice.json \ -o invoice.pdf \ https://invoicemaker.freeinvoicepro.com/api/v1/invoices/pdf/
POST/api/v1/validate
Validates the request structure and returns normalized data plus calculated totals. Invalid payloads return HTTP 422.
POST/api/v1/invoices/render
Returns escaped HTML preview markup plus calculated totals as JSON. The response does not execute submitted HTML.
GET/api/v1/templates
Returns all accepted template identifiers.
Example request JSON
{
"template": "modern",
"currency": "USD",
"seller": {
"businessName": "Example Studio",
"address": "123 Example Street",
"email": "billing@example.com"
},
"customer": {
"name": "Client Company",
"address": "456 Client Avenue"
},
"invoice": {
"title": "INVOICE",
"number": "INV-2026-001",
"issueDate": "2026-09-28",
"dueDate": "2026-10-28"
},
"items": [
{
"description": "Consulting",
"qty": 2,
"unit": "hour",
"rate": 150,
"tax": 5,
"discount": 0
}
],
"totals": {
"discountType": "percent",
"discountValue": 0,
"shipping": 0,
"adjustment": 0
},
"notes": "Thank you."
}PHP example
$payload = json_decode(file_get_contents('invoice.json'), true);
$ch = curl_init('https://invoicemaker.freeinvoicepro.com/api/v1/invoices/pdf/');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_RETURNTRANSFER => true,
]);
$pdf = curl_exec($ch);
file_put_contents('invoice.pdf', $pdf);JavaScript / fetch example
const response = await fetch('/api/v1/invoices/pdf/', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(invoice)
});
const blob = await response.blob();Same-origin browser calls work. Cross-origin CORS is not enabled by default.
Python example
import requests
invoice = {...}
r = requests.post(
'https://invoicemaker.freeinvoicepro.com/api/v1/invoices/pdf/',
json=invoice,
timeout=30,
)
r.raise_for_status()
open('invoice.pdf', 'wb').write(r.content)Field limits and behavior
| Area | Behavior |
|---|---|
| Request body | Maximum 256 KB |
| Items | Maximum 100 per invoice |
| Templates | 20 documented IDs |
| PDF requests | 30 per hour per client IP hash |
| Render requests | 60 per hour |
| Validate/templates | 120 per hour |
| Remote files | Not fetched |
| Invoice payload retention | Not intentionally stored as document history |
Error format
{
"ok": false,
"error": {
"code": "validation_failed",
"message": "The invoice payload is invalid.",
"details": ["items[0].description is required."]
}
}