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.
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
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
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
| Field | Type | Description |
|---|---|---|
template required | string | Template name, e.g. invoice, or custom:my-template. |
data required | object | The content that fills the template (see example). |
language optional | string | Label language: en, fr, es, pt. Defaults to en. |
filename optional | string | Name for the downloaded file (without extension). |
response_format optional | string | Set to url to receive a JSON link instead of raw PDF bytes. Ideal for no-code tools. |
callback_url optional | string | A public URL that receives a POST the first time the document is opened. |
track optional | boolean | Set 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
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.
| Field | Type | Description |
|---|---|---|
html required | string | The HTML document to render. |
filename optional | string | Name for the downloaded file. |
response_format optional | string | Set 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
Convert Markdown into a professionally styled PDF report — headings, tables, code blocks, blockquotes, and lists all render cleanly.
| Field | Type | Description |
|---|---|---|
markdown required | string | The Markdown content. |
accent_color optional | string | Hex color for headings and accents, e.g. #2456E6. |
filename optional | string | Name for the downloaded file. |
response_format optional | string | Set 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
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".
| Field | Type | Description |
|---|---|---|
description required | string | Plain-English description of the document (min 10 characters). |
name optional | string | Identifier to save the template under. |
sample_data optional | object | Example data used to render a preview. |
preview optional | boolean | If 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
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
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
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.
| Code | Language | Example (invoice title) |
|---|---|---|
en | English | INVOICE |
fr | French | FACTURE |
es | Spanish | FACTURA |
pt | Portuguese | FATURA |
Errors & limits
Errors return a JSON body with an error message and a standard HTTP status code.
| Status | Meaning |
|---|---|
400 | Bad request — check your parameters or JSON. |
401 | Missing or invalid API key. |
413 | Payload too large (2 MB max per request). |
429 | Monthly PDF limit reached — upgrade your plan. |
Plans
| Plan | PDFs / month | Price |
|---|---|---|
| Free | 30 | $0 |
| Starter | 500 | $15/mo |
| Pro | 5,000 | $49/mo |