Base URL: https://pdf.grabshot.dev
All API requests require an API key. Pass it as a header:
X-API-Key: pdf_your_key_here
Or as a query parameter: ?api_key=pdf_your_key_here
Convert HTML to PDF.
curl -X POST https://pdf.grabshot.dev/v1/pdf/html \
-H "Content-Type: application/json" \
-H "X-API-Key: pdf_your_key" \
-d '{
"html": "<h1>Hello World</h1><p>My first PDF</p>",
"options": {
"format": "A4",
"landscape": false,
"margin": { "top": "20mm", "bottom": "20mm", "left": "15mm", "right": "15mm" },
"printBackground": true,
"filename": "my-document.pdf"
}
}' --output document.pdf
| Parameter | Type | Default | Description |
|---|---|---|---|
format | string | A4 | Page size: A4, Letter, Legal, Tabloid, A3, A5 |
landscape | boolean | false | Landscape orientation |
margin | object | 20mm/15mm | Page margins: { top, bottom, left, right } |
printBackground | boolean | true | Print background colors/images |
width | string | — | Custom width (e.g. "210mm"). Overrides format. |
height | string | — | Custom height. Overrides format. |
headerTemplate | string | — | HTML for page header (paid plans) |
footerTemplate | string | — | HTML for page footer (paid plans) |
filename | string | document.pdf | Filename in Content-Disposition header |
Convert a URL to PDF. We render the page in a real browser.
curl -X POST https://pdf.grabshot.dev/v1/pdf/url \
-H "Content-Type: application/json" \
-H "X-API-Key: pdf_your_key" \
-d '{
"url": "https://example.com",
"options": {
"format": "A4",
"delay": 2000,
"viewport": { "width": 1280, "height": 800 }
}
}' --output page.pdf
Additional options: delay (ms, max 5000) — wait before generating. viewport — set browser viewport size. waitUntil — networkidle0 or networkidle2 (default).
Quick URL-to-PDF via query params.
curl "https://pdf.grabshot.dev/v1/pdf?api_key=pdf_your_key&url=https://example.com&format=A4" --output page.pdf
# Register
curl -X POST https://pdf.grabshot.dev/v1/users/register \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "your_password"}'
# Check usage
curl https://pdf.grabshot.dev/v1/users/me \
-H "X-API-Key: pdf_your_key"
X-Duration-Ms — Time to generate the PDF (ms)
X-Usage-Remaining — Remaining monthly quota
X-RateLimit-Limit — Requests per minute allowed
X-RateLimit-Remaining — Requests left in current window
| Code | Meaning |
|---|---|
| 400 | Bad request (missing html/url, invalid params) |
| 401 | Invalid or missing API key |
| 429 | Rate limit or monthly quota exceeded |
| 500 | PDF generation failed |