POST/api/pdf3 credits

Generate a PDF from any page. Uploaded to CDN.

Request body

FieldTypeDescription
urlstringRequired. The URL to process.
optionsobjectOptional configuration (see below).

Options

OptionTypeDescription
formatstringPage format: A4, Letter, etc. Default: A4.
landscapebooleanLandscape orientation. Default: false.
printBackgroundbooleanInclude background graphics. Default: true.
scalenumberScale of the page (0.1-2). Default: 1.
marginobjectMargins: { top, right, bottom, left }. Default: 20px each.
waitForSelectorstringWait for a CSS selector before generating.
waitUntilstring"networkidle0", "networkidle2", "load", "domcontentloaded". Default: "networkidle0".

Example request

curl -X POST https://crawlapi.dev/api/pdf \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"url":"https://example.com","options":{"format":"A4","landscape":false}}'

Example response

{
"success": true,
"data": {
"url": "https://cdn.crawlapi.dev/pdfs/abc123.pdf",
"sourceUrl": "https://example.com",
"format": "A4",
"size": "52.3 KB"
},
"credits_used": 3,
"credits_remaining": 497
}

Error codes

StatusMeaning
400Missing or invalid URL / bad options
401Missing or invalid API key
403Insufficient credits
405Wrong HTTP method (use POST)
429Rate limit exceeded (60/min)
500Server error