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/pdf

Generate a PDF from a URL.

Parameters

NameTypeRequiredDefaultDescription
urlstringYesThe URL to render as PDF.
format"A4" | "Letter" | "Legal"No"A4"Paper format.
landscapebooleanNofalseLandscape orientation.
printBackgroundbooleanNotrueInclude background colors and images.
marginobjectNo{ top: "1cm", right: "1cm", bottom: "1cm", left: "1cm" }Page margins. Each value is a CSS length (e.g., '1cm', '0.5in').
waitForstring | numberNoCSS selector to wait for, or milliseconds to wait after page load.
proxyUrlstringNoProxy URL for this request.
stealth"none" | "basic" | "full"No"full"Anti-detection level.
timeoutnumberNo30000Navigation 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