API Reference
Welcome to the Paperboy API documentation. You can use this API to programmatically generate PDF invoices by sending JSON data.
Speed
< 500ms
Protocol
HTTPS / REST
Format
JSON
Base URL
https://paperboy-mu.vercel.app/api
Generate Invoice
POSTCreate a new PDF invoice. The response will be a binary stream of the PDF file.
/generate-invoice
Request Body
| Parameter | Type | Description |
|---|---|---|
| client | String | Name of the customer or company. |
| items | Array<Object> | List of line items. Each object must contain:
|
Example Request
Switch tabs to see how to send a dynamic list of items in different languages.
const generateInvoice = async () => {
const response = await fetch('https://YOUR-API-URL/api/generate-invoice', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
client: "Stark Industries",
items: [
{ name: "Arc Reactor Blueprint", price: 5000000 },
{ name: "Consulting Fee", price: 1500 }
]
})
});
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: attachment; filename="invoice-123.pdf"