fynepdf logo
Docs menu

Generate PDF API

Write the content, get a well-set PDF: Markdown or HTML, a template (plain, report, invoice, letter, resume) in a quiet or classic style, page size, margins, header, footer and page numbers. Or send an invoice's, resume's or letter's fields as data and we lay it out; an invoice is added up and checked. Takes no input file.

POST /v1/pdf/create-pdf

Price: 2 credits per 20 pages made (started). Takes: no input file. Makes: pdf.

The same as a one-step job with the action create_pdf, which can be chained with other steps.

Request

curl -X POST https://api.fynepdf.com/v1/pdf/create-pdf \
  -H "Authorization: Bearer $FYNEPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"template":"invoice","data":{"invoice_number":"INV-104","currency":"USD","customer":{"name":"Acme Ltd"},"line_items":[{"description":"Consulting","quantity":3,"unit_price":120}],"tax_rate":10}}'

Body

ParameterTypeRequiredWhat it does
waitintegerSeconds to wait for the result (default 30).
webhook_urlstring
metadataobjectYour own keys and values, returned on the job and in webhooks.
markdownstring
htmlstring
dataobject or object or objectInstead of markdown/html: the fields of an invoice, resume or letter (set template to match). We lay it out; for an invoice we also add up the lines, tax and total and report anything that doesn't add up.
template"plain" · "report" · "invoice" · "letter" · "resume"
style"quiet" · "classic"
titlestring
page_size"A4" · "Letter"
margin"none" · "small" · "normal" · "wide"
headerstring
footerstring
page_numbersboolean

Response

A job: 200 when it finished within wait (30 seconds by default), 202 if it is still running; then poll it or use a webhook. The receipt says what each step did and cost, and outputs holds the result with a download link (good for an hour; the file is kept 24 hours).

{
  "object": "job",
  "id": "job_01jc9a2b3c4d5e6f7g8h9j",
  "status": "succeeded",
  "mode": "live",
  "inputs": [],
  "steps": [
    {
      "action": "create_pdf",
      "params": {
        "template": "invoice",
        "data": {
          "invoice_number": "INV-104",
          "currency": "USD",
          "customer": {
            "name": "Acme Ltd"
          },
          "line_items": [
            {
              "description": "Consulting",
              "quantity": 3,
              "unit_price": 120
            }
          ],
          "tax_rate": 10
        }
      }
    }
  ],
  "receipt": {
    "steps": [
      {
        "step": 1,
        "action": "create_pdf",
        "status": "succeeded",
        "credits": 1,
        "pages_before": null,
        "pages_after": 14,
        "bytes_before": null,
        "bytes_after": 4600000,
        "duration_ms": 4200
      }
    ],
    "credits": 1,
    "credits_quoted": 1,
    "duration_ms": 4300
  },
  "outputs": [
    {
      "object": "file",
      "id": "file_01jc9b7c8d9e0f1g2h3j4k",
      "filename": "result.pdf",
      "kind": "pdf",
      "bytes": 4600000,
      "pages": 14,
      "download_url": "https://files.fynepdf.com/…",
      "expires_at": "2026-11-02T10:30:00.000Z"
    }
  ],
  "error": null
}

Errors

Errors are problem details (RFC 9457) with a code you can branch on and a request_id for support.