Doc2api

Use case

Generate receipt PDFs from JSON

A payment succeeded and now somebody wants proof of it — attached to an email, filed for expenses, or handed over at a counter. It is a small document that has to be right every time and is rarely worth building a layout engine for.

Read the API docs
A receipt produced by this template
The receipt template, rendered from the payload beside it. Yours to edit once you open it.

What you send

This is the template's own sample data — the document on the left was drawn from exactly this.

{
  "data": {
    "reference": "RC-1180",
    "paid_on": "1 August 2026",
    "method": "Visa ending 4242",
    "customer": {
      "name": "Acme Ltd"
    },
    "items": [
      {
        "name": "Annual subscription",
        "amount": 588
      },
      {
        "name": "Setup",
        "amount": 150
      }
    ]
  }
}

POST it to your document's endpoint with your API key. The reply is JSON carrying a signed pdf_url — a link rather than the bytes, because a base64 document breaks receivers sitting behind a default body limit.

curl -X POST https://www.doc2api.co/api/v1/documents/<ID>/render \
  -H "X-Api-Key: d2a_live_…" \
  -H "Content-Type: application/json" \
  -d @payload.json
# → { "pdf_url": "https://…", "pdf_bytes": 17185, "sha256": "…",
#     "pdf_url_expires_at": "…" }

What the template already does

  • Reference, dates, and a table of what was paid for
  • Currency formatting that matches the amount you charged
  • A running header, so it is recognisably yours
  • A short confirmation line you can word yourself

And what you can add in the designer

Not in the starting template — a few clicks once it is open.

  • Your logo and brand colour
  • A QR code for an online copy
  • A signature block, if a person has to sign for it

Small enough to send from a webhook

A receipt is the natural thing to produce the moment your payment provider tells you money arrived. POST the values from that webhook handler and either keep the PDF in the response or have us deliver it to your own endpoint, signed.

Already have a PDF you have to use?

Designing from a template is one of the three things Doc2api does. If you were handed a form you cannot redraw — a claim form, a government return, a contract in someone else's house style — upload it instead and we read its fields into a JSON schema. Or paste your own HTML into the designer and we render that.

Open it and see for yourself

The template opens in the editor, filled with the sample data above, with a live endpoint and an API key. No account, nothing to cancel — and the first 100 test fills each month are free.