EN
Sign up

Home › Solutions › Invoice PDFs from JSON

Solution

Generate invoice PDFs from JSON

POST your invoice data as JSON and get back a finished PDF on your own template. No HTML to wrangle and no headless browser to run, just a REST API call.

Need a starting design? Browse the invoice PDF templates, copy one into your project, and publish your version before connecting the API.

# 1. Request the invoice: POST your data as JSON
curl -X POST https://api.shippdf.com/v1/documents \
  -H "Authorization: Bearer $SHIPPDF_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "template_id": "tmpl_example",
    "expiry_minutes": 60,
    "data": {
      "number": "INV-1042",
      "customer": "Acme Co.",
      "items": [
        { "desc": "Design work", "qty": 12, "rate": 90 },
        { "desc": "Hosting",     "qty": 1,  "rate": 40 }
      ]
    }
  }'
# → 202 { "id": "doc_a3...", "status": "queued" }

# 2. Check status; repeat until completed or failed
curl https://api.shippdf.com/v1/documents/doc_a3... \
  -H "Authorization: Bearer $SHIPPDF_TOKEN"
# → { "status": "completed", "expiry_minutes": 60, "pdf_url": "…/inv-1042.pdf" }

Use your published template ID and a workspace API token with documents:create and documents:read. The example sets each PDF link's lifetime to one hour. Set expiry_minutes from 15 to 10080 minutes (7 days), or omit it to use the workspace default, initially 15 minutes. Read the document again for a fresh link with the same saved duration.

List recent generations with GET /v1/documents, or follow the API quickstart for a complete example and pagination details.

Why generate invoices this way

Generate invoices without code

Prefer not to touch the API? Add a render step in Zapier, Make, n8n, Airtable or Google Sheets and map your fields to the invoice template. Every route reaches the same templates.

Questions

How do I generate an invoice PDF from JSON?

Send your invoice data as JSON to ShipPDF, naming the invoice template you designed. You get back a finished PDF, as a hosted link, an emailed attachment, or written straight back to a record. Line-item tables handle their own page breaks and running totals.

Can I generate invoices without writing code?

Yes. Add a ShipPDF render step in Zapier, Make, n8n, Airtable or Google Sheets and map your fields to the template. Developers can call the REST API directly instead.

Sign up
← Back to home