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

GET

Retrieve a list of available PDF design templates.

/templates
Response Example (200 OK)
["classic", "modern"]

Generate Invoice

POST

Create a new PDF invoice. The response will be a binary stream of the PDF file.

/generate

Request Body

ParameterTypeDescription
clientStringName of the customer or company.
templateStringOptional. One of the available templates (e.g., classic). Defaults to classic.
itemsArray<Object>List of line items. Each object must contain:
  • name (string)
  • price (number)
  • qty (number, optional)

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"