The invoice generator API for your data
Design an invoice template once, then generate branded PDF invoices from your own data with a single API call, one at a time or thousands at once.
Design an invoice template once, then generate branded PDF invoices from your own data with a single API call, one at a time or thousands at once.
If your app or backend needs to produce invoices, you don't have to build a PDF engine or wrestle with HTML-to-PDF libraries. With DocuPotion you design a reusable invoice template, then fill it from your own code with a single call to our REST API. Send your invoice data, get back a finished PDF, every copy correct and on-brand.
Three steps from invoice data to a finished PDF returned by the DocuPotion API.
Build an invoice template in DocuPotion with the AI-powered editor, or upload an invoice you already use. Your layout, logo, fonts and fixed text stay exactly as you want them.
Mark the dynamic values as merge fields, like {{customer}}, {{invoice_number}} and {{total}}. Line items repeat automatically, so a single template handles invoices with any number of rows.
Send your invoice data to the /create endpoint and DocuPotion returns the finished invoice as a file, a hosted URL or base64. Generate one invoice on demand, or loop through thousands in a single run.

A single POST request to /v1/create turns your template and JSON data into a finished PDF invoice. Copy a sample below and you're generating invoices in minutes.
curl -X POST https://api.docupotion.com/v1/create \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"templateId": "your_template_id",
"output": "url",
"expiration": 60,
"data": {
"name": "John Doe",
"invoice_number": "INV-001",
"items": [
{ "description": "Product A", "quantity": 2, "price": 50.00 },
{ "description": "Product B", "quantity": 1, "price": 75.00 }
],
"total": 175.00
}
}'// Using fetch (Node 18+)
const response = await fetch("https://api.docupotion.com/v1/create", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
templateId: "your_template_id",
output: "url",
expiration: 60,
data: {
name: "John Doe",
invoice_number: "INV-001",
items: [
{ description: "Product A", quantity: 2, price: 50.0 },
{ description: "Product B", quantity: 1, price: 75.0 },
],
total: 175.0,
},
}),
});
const result = await response.json();
console.log(result.url); // URL to your generated PDFimport requests
response = requests.post(
"https://api.docupotion.com/v1/create",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"templateId": "your_template_id",
"output": "url",
"expiration": 60,
"data": {
"name": "John Doe",
"invoice_number": "INV-001",
"items": [
{"description": "Product A", "quantity": 2, "price": 50.00},
{"description": "Product B", "quantity": 1, "price": 75.00},
],
"total": 175.00,
},
},
)
result = response.json()
print(result["url"]) # URL to your generated PDF<?php
$payload = [
"templateId" => "your_template_id",
"output" => "url",
"expiration" => 60,
"data" => [
"name" => "John Doe",
"invoice_number" => "INV-001",
"items" => [
["description" => "Product A", "quantity" => 2, "price" => 50.00],
["description" => "Product B", "quantity" => 1, "price" => 75.00],
],
"total" => 175.00,
],
];
$ch = curl_init("https://api.docupotion.com/v1/create");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
$response = curl_exec($ch);
$result = json_decode($response, true);
echo $result["url"]; // URL to your generated PDFrequire "net/http"
require "json"
require "uri"
uri = URI("https://api.docupotion.com/v1/create")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path, {
"Authorization" => "Bearer YOUR_API_KEY",
"Content-Type" => "application/json",
})
request.body = {
templateId: "your_template_id",
output: "url",
expiration: 60,
data: {
name: "John Doe",
invoice_number: "INV-001",
items: [
{ description: "Product A", quantity: 2, price: 50.00 },
{ description: "Product B", quantity: 1, price: 75.00 },
],
total: 175.00,
},
}.to_json
response = http.request(request)
result = JSON.parse(response.body)
puts result["url"] # URL to your generated PDFNeed more detail? See the full API reference.
Pick a professionally designed starting point, then fill it from your data with the API.
| Description | Qty | Unit price | Amount |
|---|---|---|---|
|
Monthly lawn maintenance
|
4 | $65.00 | $260.00 |
|
Spring fertilizer & weed treatment
|
1 | $180.00 | $180.00 |
|
Mulch installation — front beds
|
3 | $85.00 | $255.00 |
|
Pruning — crepe myrtles (front)
|
1 | $120.00 | $120.00 |
Small Business Invoice
| Description | Qty | Price | Amount |
|---|---|---|---|
|
Full-day wedding coverage
|
1 | $4,200.00 | $4,200.00 |
|
Pre-wedding engagement session
|
1 | $650.00 | $650.00 |
|
Premium album
|
1 | $780.00 | $780.00 |
|
Travel & accommodation
|
1 | $320.00 | $320.00 |
Photography Invoice
| Description | Qty | Unit price | Amount |
|---|---|---|---|
|
Service A
|
1 | $500.00 | $500.00 |
|
Service B
|
2 | $250.00 | $500.00 |
|
Service C
|
1 | $100.00 | $100.00 |
|
Service D
|
4 | $50.00 | $200.00 |
Simple Invoice
| Phase / Work item | Contract value | Prior billed | % complete | This period |
|---|---|---|---|---|
| 01 — General conditions | $85,000.00 | $59,500.00 | 78% | $6,800.00 |
| 02 — Site work & demolition | $120,000.00 | $120,000.00 | 100% | $0.00 |
| 03 — Concrete & framing | $340,000.00 | $272,000.00 | 85% | $17,000.00 |
| 04 — MEP rough-in | $210,000.00 | $147,000.00 | 78% | $16,800.00 |
| 05 — Drywall & finishes | $165,000.00 | $33,000.00 | 30% | $16,500.00 |
| 06 — Doors, frames & glazing | $92,000.00 | $0.00 | 12% | $11,040.00 |
| CO # / Description | Approved | Prior billed | % complete | This period |
|---|---|---|---|---|
| CO-003 · Upgraded HVAC controls package | $28,400.00 | $0.00 | 40% | $11,360.00 |
Construction Progress Invoice
| Description | Qty | UoM | Unit price | Amount |
|---|---|---|---|---|
|
Industrial bearing assembly, type B2-440
|
120 | pcs | 48.20 | 5,784.00 |
|
Hydraulic actuator, 25 kN
|
30 | pcs | 186.50 | 5,595.00 |
|
Replacement seal kit RK-9
|
20 | pack | 32.00 | 640.00 |
Proforma Invoice
| Date | Attorney | Description of services | Hours | Rate | Amount |
|---|---|---|---|---|---|
| Apr 02 | JCW | Review and revise asset purchase agreement, draft markup of indemnification provisions; conference with client re: same. | 3.4 | $925 | $3,145.00 |
| Apr 04 | RPL | Draft disclosure schedules; review counterparty schedules; correspondence with seller's counsel. | 5.2 | $780 | $4,056.00 |
| Apr 09 | JCW | Negotiation call with seller's counsel re: closing conditions and material adverse change definition; follow-up memo to client. | 2.8 | $925 | $2,590.00 |
| Apr 11 | AMP | Conduct IP diligence on assigned patents; prepare memo summarizing assignment chain risks. | 6.0 | $560 | $3,360.00 |
| Apr 16 | RPL | Revise schedules per client comments; prepare closing checklist and signature pages. | 4.1 | $780 | $3,198.00 |
| Apr 22 | JCW | Review HSR filing draft; conference with antitrust counsel; revise filing. | 2.2 | $925 | $2,035.00 |
| Date | Description | Amount |
|---|---|---|
| Apr 12 | Filing fee — HSR notification (premerger) | $125,000.00 |
| Apr 18 | Document production services (third-party vendor) | $1,840.00 |
| Apr 28 | Travel — Boston meeting (flight, lodging, ground) | $1,422.00 |
Law Firm Invoice (Statement of Services)
| No. | Description of goods | HS code | Origin | Qty | UoM | Unit value | Total value |
|---|---|---|---|---|---|---|---|
| 1 | Cordless impact drill, 18V, model RX-9 | 8467.21.00 | US | 240 | pcs | 84.50 | 20,280.00 |
| 2 | Lithium-ion battery pack 5.0 Ah | 8507.60.00 | US | 480 | pcs | 32.00 | 15,360.00 |
| 3 | Drill bit set, 24-piece HSS | 8207.50.40 | US | 240 | set | 18.20 | 4,368.00 |
| 4 | Carrying case, hard-shell ABS | 4202.92.90 | CN | 240 | pcs | 9.40 | 2,256.00 |
Commercial Invoice
| Description | Hours | Rate | Amount |
|---|---|---|---|
|
Brand discovery workshop
|
5 | $120/hr | $600.00 |
|
Homepage design
|
14 | $120/hr | $1,680.00 |
|
Component library setup
|
8 | $120/hr | $960.00 |
|
Project management
|
3 | $120/hr | $360.00 |
Freelance Invoice
| Description | Hours | Rate | Amount |
|---|---|---|---|
| Demolition crew (2 workers, 3 days) | 48 | $65.00 | $3,120.00 |
| Lead carpenter — framing | 32 | $85.00 | $2,720.00 |
| Apprentice carpenter — framing | 32 | $45.00 | $1,440.00 |
| Project supervision | 8 | $95.00 | $760.00 |
| Item | Qty | Unit | Amount |
|---|---|---|---|
| 2x4 SPF studs (8 ft) | 60 | $4.20 | $252.00 |
| 1/2" plywood sheathing | 12 | $38.00 | $456.00 |
| Framing nails 16d (5 lb box) | 4 | $22.00 | $88.00 |
| Dumpster rental (10 yd) | 1 | $385.00 | $385.00 |
| Miscellaneous fasteners + hardware | 1 | $164.00 | $164.00 |
Contractor Invoice
| Item | Seats / Qty | Unit price | Amount |
|---|---|---|---|
|
Lattice Team — monthly subscription
|
24 | $32.00 | $768.00 |
|
Premium support add-on
|
1 | $199.00 | $199.00 |
|
API overage
|
127,420 | $0.0008 | $101.94 |
|
SSO add-on
|
1 | $60.00 | $60.00 |
Software / SaaS Invoice
Design a reusable invoice template in DocuPotion and mark the dynamic values as merge fields. Then send your invoice data to the /create endpoint, matching your data to the template's merge fields, and DocuPotion returns the finished PDF invoice. You can do this for a single invoice or for thousands in one run.
Yes. Once the template is ready you can fill it as many times as you need. Loop through a list of records and call the API for each one to generate completed invoices in bulk, every copy filled correctly from your data.
Yes. Line items are handled as a repeating section, so the same template works whether an invoice has one row or fifty. You pass an array of line items and DocuPotion lays them out and totals them automatically.
The API can return the invoice as a downloadable file, a hosted URL, or a base64 string. Use a file or URL to email or store the invoice, or base64 when you want to embed it directly in another response.
Any language that can make an HTTP request. The DocuPotion API is a standard REST endpoint, so it works with Python, PHP, Node.js, Ruby, Go and more. See our guides on generating PDFs with Python and PHP for worked examples.
No. If you would rather not touch the API, you can generate invoices from the tools you already use, such as Airtable, Zapier and n8n. The REST API is there for when you want to drive the whole thing from your own backend.
Yes. DocuPotion templates support your own logo, colours, fonts and layout, so every generated invoice looks on-brand and consistent. You can also upload an invoice you already use and turn it into a template.
Design your invoice template once, then fill it from your data with a single call. Start free with 50 documents, no credit card required.
Start free trial