Markdown to PDF API
Send Markdown in a JSON body and get a paginated PDF back in the same response. Headings become a table of contents with real page numbers, fenced code is highlighted, and tables repeat their header row across pages. There is no browser to run and no headless rendering to operate on your side.
One request
Authenticate with a bearer key and post JSON. The response body is the PDF.
curl -X POST https://docpress.dev/v1/pdf \
-H "Authorization: Bearer dp_your_key" \
-H "Content-Type: application/json" \
-d '{"markdown": "# Release notes\n\n## Changes\n\n- Faster exports\n- New Letter theme", "theme": "clean", "toc": true}' \
-o release-notes.pdfA successful call returns 200 with an application/pdf body and the headers X-Pages, X-Quota-Used and X-Quota-Limit. Errors are JSON: 400 when neither html nor markdown is present, 401 for a bad key, 413 when the source is over 2 MB, 422 when the document cannot be rendered (the message says why), and 429 when the monthly quota is reached.
What the Markdown renderer supports
The input is the common fenced-code-and-tables dialect most editors and code hosts use.
- Headings, with
##and###collected into the table of contents whentocis on. - Tables (pipe syntax). The header row repeats at the top of each page a long table spans.
- Fenced code blocks with syntax highlighting when the fence names a language (
```python). Unlabelled fences are rendered as plain monospace. - Footnotes, definition lists, abbreviations and smart punctuation.
- Admonitions (
!!! note) for call-out boxes. - Inline HTML inside Markdown passes through to the renderer.
- Images, as
data:URIs only.
Document options
Everything else is a field on the same request. All are optional.
theme:clean(default),report,minimal,letter, ornoneto use only your own CSS.page_size:A4(default),Letter,Legal,A5.cover,toc,page_numbers: booleans. Page numbers default to on and print as n / total at the bottom centre.title,author,date: used on the cover and in the PDF metadata. The title defaults to the first#heading.header,footer: running text at the top right and bottom left of every page.css: extra CSS appended after the theme, including@pagerules.filename: the name in theContent-Dispositionheader.
Limits to know before you build
- No JavaScript is executed. Send the final HTML; anything a script would have drawn or filled in will not appear.
- The renderer has no network access. Images, fonts and stylesheets at external URLs are never fetched; inline them as
data:URIs. A request that references an external URL fails with a 422 that names the URL, rather than silently dropping the asset. - 2 MB of source per request, 300 pages per document, 2 concurrent renders per account.
- Free-plan output carries a small
docpress.devfooter mark. Paid plans (from $9/month) do not. - Installed fonts: DejaVu, Liberation, Noto, Carlito and Caladea. Embed any other font with an
@font-facerule whosesrcis adata:URI.
Pricing
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
Which Markdown dialect is this?
The widely used fenced-code-and-tables dialect: pipe tables, fenced code blocks, footnotes, definition lists, task-style lists and inline HTML. Admonitions (!!! note) are also supported.
Can I use my own CSS or fonts?
Yes. Put extra CSS in the css field; it is appended after the theme. Set theme to none for a blank slate. Fonts other than the installed set must be embedded with @font-face and a data: URI.
Does the free plan mark the output?
Yes. Free-plan PDFs carry a small docpress.dev footer mark. Starter, Pro and Scale output has no mark.
Do you keep my documents?
No. The API returns the PDF and does not keep a copy of your source or the output. Only a per-account usage count and the page count of each render are logged.
What happens when my Markdown cannot be rendered?
You get a 422 with a JSON message that says why, most often an external image URL. Fix the input and resend; failed renders are not counted against your quota.
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