API Documentation

PDFMint turns structured data into professional PDFs from a single request — with built-in open-tracking, AI template creation, and multi-language output. Every endpoint is a plain HTTPS call that returns either a PDF file or JSON.

Base URL https://pdfmintapi.com

Authentication

Every request is authenticated with an API key sent as a Bearer token. Keep your key secret — anyone with it can generate documents on your account.

Authorization: Bearer pm_your_api_key_here

POST Get an API key

/v1/keys

Create a free account and receive an API key. The free plan includes 30 PDFs per month. You can also get one from the "Get free API key" button on pdfmintapi.com.

Request

curl -X POST https://pdfmintapi.com/v1/keys \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]"}'

Response

{
  "api_key": "pm_a1b2c3...",
  "plan": "free",
  "monthly_limit": 30
}

POST Generate PDF from template

/v1/generate

Generate a PDF from a built-in template (invoice, receipt, certificate, report, packing-slip) or a saved custom template. Returns the PDF file by default, or a JSON link when response_format is url.

Body parameters

FieldTypeDescription
template requiredstringTemplate name, e.g. invoice, or custom:my-template.
data requiredobjectThe content that fills the template (see example).
language optionalstringLabel language: en, fr, es, pt. Defaults to en.
filename optionalstringName for the downloaded file (without extension).
response_format optionalstringSet to url to receive a JSON link instead of raw PDF bytes. Ideal for no-code tools.
callback_url optionalstringA public URL that receives a POST the first time the document is opened.
track optionalbooleanSet to false to disable hosted-link tracking and storage.

Request

curl -X POST https://pdfmintapi.com/v1/generate \
  -H "Authorization: Bearer pm_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "template": "invoice",
    "language": "en",
    "response_format": "url",
    "data": {
      "invoice_number": "INV-001",
      "from": { "name": "My Studio" },
      "to": { "name": "Acme Corp" },
      "items": [
        { "name": "Design work", "qty": 1,
          "unit_price": "500.00", "amount": "500.00", "currency": "$" }
      ],
      "subtotal": "500.00", "total": "500.00", "currency": "$"
    }
  }'

Response response_format: url

{
  "document_id": "a1b2c3d4e5",
  "filename": "document.pdf",
  "pdf_url": "https://pdfmintapi.com/v1/documents/a1b2c3d4e5/raw",
  "view_url": "https://pdfmintapi.com/d/a1b2c3d4e5",
  "usage": "1/30"
}

// Without response_format, the response body is the raw PDF (Content-Type: application/pdf). The tracking link is returned in the X-View-Url header.

POST Generate PDF from HTML

/v1/generate/html

Render your own HTML and CSS into a PDF with a real Chromium engine. Full control over layout when the built-in templates aren't enough.

FieldTypeDescription
html requiredstringThe HTML document to render.
filename optionalstringName for the downloaded file.
response_format optionalstringSet to url for a JSON link.
curl -X POST https://pdfmintapi.com/v1/generate/html \
  -H "Authorization: Bearer pm_your_key" \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Hello PDF</h1>","filename":"page"}'

POST Generate PDF from Markdown

/v1/generate/markdown

Convert Markdown into a professionally styled PDF report — headings, tables, code blocks, blockquotes, and lists all render cleanly.

FieldTypeDescription
markdown requiredstringThe Markdown content.
accent_color optionalstringHex color for headings and accents, e.g. #2456E6.
filename optionalstringName for the downloaded file.
response_format optionalstringSet to url for a JSON link.
curl -X POST https://pdfmintapi.com/v1/generate/markdown \
  -H "Authorization: Bearer pm_your_key" \
  -H "Content-Type: application/json" \
  -d '{"markdown":"# Report\n\n**Bold** and a list:\n- one\n- two"}'

POST Create a Magic Template AI

/v1/templates/magic

Describe the document you need in plain English and get a custom, reusable template built by AI. Once created, use it like any built-in template with "template": "custom:your-name".

FieldTypeDescription
description requiredstringPlain-English description of the document (min 10 characters).
name optionalstringIdentifier to save the template under.
sample_data optionalobjectExample data used to render a preview.
preview optionalbooleanIf true, returns a preview PDF instead of the template metadata.
curl -X POST https://pdfmintapi.com/v1/templates/magic \
  -H "Authorization: Bearer pm_your_key" \
  -H "Content-Type: application/json" \
  -d '{"description":"a modern price quote with a client name and a price table","name":"quote"}'

GET List templates

/v1/templates

Returns all built-in templates, each with a ready-to-use sample payload you can copy straight into a generate request. No authentication required.

curl https://pdfmintapi.com/v1/templates

GET Document status tracking

/v1/documents/{id}/status

Check whether a generated document has been opened, when, and how many times. This is the tracking data that makes PDFMint different — know when your invoice was actually seen.

{
  "document_id": "a1b2c3d4e5",
  "viewed": true,
  "viewed_at": "2026-07-08T14:20:00Z",
  "view_count": 3
}

GET Usage

/v1/usage

Returns your current plan, billing period, PDFs used, and monthly limit. Useful for checking your quota before hitting it.

curl https://pdfmintapi.com/v1/usage \
  -H "Authorization: Bearer pm_your_key"

// → { "plan": "free", "period": "2026-07", "used": 3, "limit": 30 }

Languages

Pass "language" on any template request to translate the document's fixed labels. Your own data is never translated — only labels like INVOICE, Bill to, and Total due.

CodeLanguageExample (invoice title)
enEnglishINVOICE
frFrenchFACTURE
esSpanishFACTURA
ptPortugueseFATURA

Errors & limits

Errors return a JSON body with an error message and a standard HTTP status code.

StatusMeaning
400Bad request — check your parameters or JSON.
401Missing or invalid API key.
413Payload too large (2 MB max per request).
429Monthly PDF limit reached — upgrade your plan.

Plans

PlanPDFs / monthPrice
Free30$0
Starter500$15/mo
Pro5,000$49/mo