API Reference
Welcome to the Paperboy API documentation. You can use this API to programmatically generate PDF invoices by sending raw JSON data.
Speed
< 500ms
Protocol
HTTPS / REST
Format
JSON
Base URL
https://paperboy-mu.vercel.app/api
Get Templates
GETRetrieve a list of available PDF design templates.
/templates
Response Example (200 OK)
["classic", "modern"]
Generate Invoice
POSTCreate a new PDF invoice. The response will be a binary stream of the PDF file.
/generate
Request Body
| Parameter | Type | Description |
|---|---|---|
| client | String | Name of the customer or company. |
| template | String | Optional. One of the available templates (e.g., classic). Defaults to classic. |
| items | Array<Object> | List of line items. Each object must contain:
|
Example Request
Copy these snippets to test the API immediately.
const generateInvoice = async () => {
const response = await fetch('https://paperboy-mu.vercel.app/api/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
client: "Stark Industries",
template: "modern",
items: [
{ name: "Arc Reactor Blueprint", price: 5000000 },
{ name: "Consulting Fee", price: 1500, qty: 2 }
]
})
});
if (response.ok) {
const blob = await response.blob();
// Logic to save or display the blob...
}
};Response
If successful, the API returns a 200 OK status and streams the PDF file directly.
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: inline; filename="invoice.pdf"