Markdown to PDF API

Send Markdown in a POST request to /api/export-pdf and the response is the PDF — the same engine as the editor, with page numbers, themes and A4 or Letter. There is no API key: the endpoint is free, with a fair-use limit of 20 requests a minute per address.

Make a request

curl (macOS, Linux)
curl -X POST https://cropmark.app/api/export-pdf \
  -H "Content-Type: application/json" \
  -d '{"markdown": "# Report\n\nHello.", "options": {"paper": "a4"}}' \
  -o report.pdf
PowerShell (Windows)
$body = @{ markdown = "# Report`n`nHello."; options = @{ paper = "letter" } } | ConvertTo-Json
Invoke-WebRequest -Uri https://cropmark.app/api/export-pdf -Method Post `
  -ContentType "application/json; charset=utf-8" `
  -Body ([Text.Encoding]::UTF8.GetBytes($body)) -OutFile report.pdf
JavaScript (Node 18+, as an ES module)
import { writeFile } from 'node:fs/promises';

const response = await fetch('https://cropmark.app/api/export-pdf', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ markdown: '# Report\n\nHello.', options: { theme: 'minimal' } }),
});
if (!response.ok) throw new Error((await response.json()).message);
await writeFile('report.pdf', Buffer.from(await response.arrayBuffer()));

Options

Every option is optional; the defaults are shown.

FieldValuesDefault
themeelegant, minimal, technicalelegant
papera4, lettera4
marginnarrow, normal, widenormal
pageNumberstrue, falsetrue
headerTextUp to 200 charactersThe document title
footerTextUp to 200 charactersNone

Responses

StatusMeaning
200The PDF, as application/pdf, named from the document title
400Missing markdown, or an option outside the values above
413More than 2 MB of Markdown
429Over the per-minute limit; the Retry-After header says when to retry
503The server is busy; retry after the Retry-After delay
504The document took too long to render

Errors are JSON: { "error": "…", "message": "…" }.

Questions

Do I need an API key?

No. The endpoint is open, limited to 20 requests a minute per address.

Can I call it from a web page on another site?

Not directly: it sends no CORS headers. Call it from a server or a script.

Is the API stable?

It is public but not versioned yet. Fields may be added; breaking changes will be announced on this page first.

Are documents sent to the API stored?

No. They are rendered in memory and discarded, like documents from the editor.

Try it on your own document

Paste your Markdown, check the page, download the PDF. Free, with no sign-up.

Open Cropmark

Published . Updated .