DocPress

Generate invoice PDFs from JSON

Post your invoice data as JSON and get a finished PDF back. The hosted invoice template handles layout, line-item tables that span pages and page numbering, so your code only supplies the data. If you need your own look, send HTML or Markdown to the same endpoint instead.

The hosted invoice template

Pass template: "invoice" and a data object with your details, the client's details and line items. Line totals, subtotal, optional discount, tax and the grand total are computed on the server from quantity and unit price.

POST https://docpress.dev/v1/pdf
Authorization: Bearer dp_your_key
Content-Type: application/json

{
  "template": "invoice",
  "data": {
    "number": "INV-1042",
    "date": "2026-10-18",
    "due_date": "2026-11-17",
    "currency": "USD",
    "from": {"name": "Northwind Studio", "address_lines": ["12 Example Road", "Springfield"], "email": "billing@example.com"},
    "to": {"name": "Acme Client Ltd", "address_lines": ["1 Sample Street", "Shelbyville"]},
    "items": [
      {"description": "Design, October", "quantity": 10, "unit_price": 120},
      {"description": "Hosting", "quantity": 1, "unit_price": 40}
    ],
    "tax_rate": 8.25, "tax_label": "Sales tax",
    "notes": "Payable within 30 days.",
    "payment_instructions": "Bank transfer, reference INV-1042"
  },
  "page_size": "Letter",
  "filename": "INV-1042.pdf"
}

Optional fields include discount, logo (a data: URI) and accent colour. The full field list is at /templates/invoice.

Or bring your own layout

A Markdown table is enough for a plain invoice, and the report or minimal theme does the typography:

{"markdown": "# Invoice INV-1042\n\n**Due:** 17 November 2026\n\n| Item | Qty | Unit | Amount |\n|---|--:|--:|--:|\n| Design, October | 10 | $120.00 | $1,200.00 |\n| Hosting | 1 | $40.00 | $40.00 |\n\n**Total: $1,240.00**", "theme": "minimal", "footer": "Payable within 30 days"}

For a branded design, send html with your own css. See HTML to PDF API.

What invoices need from a PDF engine

  • Rows that do not split across a page boundary: tr { break-inside: avoid } in your CSS, built into the hosted template.
  • Table headers that repeat on every page of a long invoice.
  • Page n / total in the footer, so a multi-page invoice is obviously complete.
  • Arithmetic done once, on the server: the hosted template computes line totals, discount, tax and total from the numbers you send, so a rounding difference between your code and the PDF cannot creep in.

Running it in production

  • Store the returned PDF yourself (object storage or your database). The API does not keep a copy of the source or the output.
  • Watch X-Quota-Used and X-Quota-Limit on each response; handle 429 by queueing rather than retrying in a tight loop.
  • Up to 2 renders run concurrently per account; batch jobs should use a small worker pool.
  • Keep secrets out of the document: the API only needs what should be printed.

Pricing for invoice volume

Plans are capped. When a plan's monthly document count is reached the API returns 429 until you upgrade or the month rolls over; there is no overage billing.

  • Free: 50 documents/month, footer mark on output, no card required.
  • Starter: $9/month, 500 documents, no mark.
  • Pro: $29/month, 3,000 documents.
  • Scale: $79/month, 15,000 documents.

Every response includes X-Quota-Used and X-Quota-Limit headers so you can watch usage without polling. Details on the pricing page.

Questions

Can I put my logo on the invoice?

Yes, as a data: URI (PNG, JPEG or SVG). External image URLs are never fetched.

Does the template calculate totals and tax?

Yes. Send quantity and unit_price per item plus an optional discount and tax_rate (a percentage); the template computes line totals, subtotal, tax and the grand total. Check the result against your own records before sending an invoice.

Can the API email the invoice to my customer?

No. You receive the PDF bytes and send them through your own email or storage. Nothing is stored or forwarded by the API.

Is there a watermark on the free plan?

Free-plan PDFs carry a small docpress.dev footer mark, which is fine for testing. Paid plans from $9/month remove it.

Related

Free previews carry a watermark and are deleted after 24 hours. Free API output carries a footer mark. The renderer runs no JavaScript and never fetches external URLs. Privacy · Terms · Refunds