API Reference
PDF Generation
Generate PDFs from any URL using a real browser engine. Supports paper format, orientation, margins, and background printing. Returns the PDF as binary data.
POST
/v1/pdfGenerate a PDF from a URL.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | Yes | — | The URL to render as PDF. |
format | "A4" | "Letter" | "Legal" | No | "A4" | Paper format. |
landscape | boolean | No | false | Landscape orientation. |
printBackground | boolean | No | true | Include background colors and images. |
margin | object | No | { top: "1cm", right: "1cm", bottom: "1cm", left: "1cm" } | Page margins. Each value is a CSS length (e.g., '1cm', '0.5in'). |
waitFor | string | number | No | — | CSS selector to wait for, or milliseconds to wait after page load. |
proxyUrl | string | No | — | Proxy URL for this request. |
stealth | "none" | "basic" | "full" | No | "full" | Anti-detection level. |
timeout | number | No | 30000 | Navigation timeout in milliseconds. |
Request Body
{
"url": "https://example.com",
"format": "A4",
"landscape": false,
"printBackground": true,
"margin": {
"top": "2cm",
"right": "1.5cm",
"bottom": "2cm",
"left": "1.5cm"
}
}Response
Returns binary PDF data with Content-Type: application/pdf andContent-Disposition: inline; filename="page.pdf".
curl -X POST https://api.browsefleet.com/v1/pdf \
-H "Content-Type: application/json" \
-H "x-api-key: bf_your_api_key" \
-d '{
"url": "https://example.com",
"format": "A4",
"printBackground": true
}' --output page.pdf