POST /accounts/{account_id}/browser-rendering/pdf
Fetches rendered PDF from provided URL or HTML. Check available options like gotoOptions
and waitFor*
to control page load behaviour.
Servers
- https://api.cloudflare.com/client/v4
Path parameters
Name | Type | Required | Description |
---|---|---|---|
account_id |
String | Yes |
Account ID. |
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Query parameters
Name | Type | Required | Description |
---|---|---|---|
cacheTTL |
Number | No |
Cache TTL default is 5s. Set to 0 to disable. Default value: 5 |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
allowRequestPattern[] |
Array | No |
Only allow requests that match the provided regex patterns, eg. '/^.*.(css)'. |
setExtraHTTPHeaders |
Object | No | |
cookies[] |
Array | No |
Check options. |
cookies[].sourceScheme |
No | ||
cookies[].url |
String | No | |
cookies[].httpOnly |
Boolean | No | |
cookies[].domain |
String | No | |
cookies[].value |
String | Yes | |
cookies[].partitionKey |
String | No | |
cookies[].path |
String | No | |
cookies[].sourcePort |
Number | No | |
cookies[].sameParty |
Boolean | No | |
cookies[].priority |
No | ||
cookies[].name |
String | Yes | |
cookies[].secure |
Boolean | No | |
cookies[].sameSite |
No | ||
cookies[].expires |
Number | No | |
url |
String | No |
URL to navigate to, eg. |
allowResourceTypes[] |
Array | No |
Only allow requests that match the provided resource types, eg. 'image' or 'script'. |
viewport |
Object | No |
Check options. Default value: { "width": 1920, "height": 1080 } |
viewport.deviceScaleFactor |
Number | No | |
viewport.height |
Number | Yes | |
viewport.isLandscape |
Boolean | No | |
viewport.width |
Number | Yes | |
viewport.isMobile |
Boolean | No | |
viewport.hasTouch |
Boolean | No | |
waitForTimeout |
Number | No |
Waits for a specified timeout before continuing. |
emulateMediaType |
String | No | |
actionTimeout |
Number | No |
The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error. |
addScriptTag[] |
Array | No |
Adds a |
addScriptTag[].id |
String | No | |
addScriptTag[].url |
String | No | |
addScriptTag[].content |
String | No | |
addScriptTag[].type |
String | No | |
gotoOptions |
Object | No |
Check options. |
gotoOptions.referrerPolicy |
String | No | |
gotoOptions.timeout |
Number | No |
Default value: 30000 |
gotoOptions.waitUntil |
No |
Default value: "domcontentloaded" |
|
gotoOptions.referer |
String | No | |
html |
String | No |
Set the content of the page, eg: |
pdfOptions |
Object | No |
Check options. |
pdfOptions.height |
No |
Sets the height of paper. Can be a number or string with unit. |
|
pdfOptions.headerTemplate |
String | No |
HTML template for the print header. |
pdfOptions.width |
No |
Sets the width of paper. Can be a number or string with unit. |
|
pdfOptions.outline |
Boolean | No |
Generate document outline. Default value: false |
pdfOptions.preferCSSPageSize |
Boolean | No |
Give CSS @page size priority over other size declarations. Default value: false |
pdfOptions.margin |
Object | No |
Set the PDF margins. Useful when setting header and footer. |
pdfOptions.margin.right |
No | ||
pdfOptions.margin.top |
No | ||
pdfOptions.margin.bottom |
No | ||
pdfOptions.margin.left |
No | ||
pdfOptions.pageRanges |
String | No |
Paper ranges to print, e.g. '1-5, 8, 11-13'. |
pdfOptions.omitBackground |
Boolean | No |
Hides default white background and allows generating pdfs with transparency. Default value: false |
pdfOptions.printBackground |
Boolean | No |
Set to true to print background graphics. Default value: false |
pdfOptions.displayHeaderFooter |
Boolean | No |
Whether to show the header and footer. Default value: false |
pdfOptions.format |
String | No |
Paper format. Takes priority over width and height if set. Valid values:
Default value: "letter" |
pdfOptions.footerTemplate |
String | No |
HTML template for the print footer. |
pdfOptions.landscape |
Boolean | No |
Whether to print in landscape orientation. Default value: false |
pdfOptions.tagged |
Boolean | No |
Generate tagged (accessible) PDF. Default value: true |
pdfOptions.timeout |
Number | No |
Timeout in milliseconds. Default value: 30000 |
pdfOptions.scale |
Number | No |
Scales the rendering of the web page. Amount must be between 0.1 and 2. Default value: 1 |
rejectResourceTypes[] |
Array | No |
Block undesired requests that match the provided resource types, eg. 'image' or 'script'. |
waitForSelector |
Object | No |
Wait for the selector to appear in page. Check options. |
waitForSelector.hidden |
Boolean | No |
Valid values:
|
waitForSelector.selector |
String | Yes | |
waitForSelector.visible |
Boolean | No |
Valid values:
|
waitForSelector.timeout |
Number | No | |
bestAttempt |
Boolean | No |
Attempt to proceed when 'awaited' events fail or timeout. |
addStyleTag[] |
Array | No |
Adds a |
addStyleTag[].url |
String | No | |
addStyleTag[].content |
String | No | |
authenticate |
Object | No |
Provide credentials for HTTP authentication. |
authenticate.username |
String | Yes | |
authenticate.password |
String | Yes | |
rejectRequestPattern[] |
Array | No |
Block undesired requests that match the provided regex patterns, eg. '/^.*.(css)'. |
setJavaScriptEnabled |
Boolean | No | |
userAgent |
String | No |
Default value: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.