POST /accounts/{account_id}/browser-rendering/json
Gets json from a webpage from a provided URL or HTML. Pass prompt
or schema
in the body. Control page loading with gotoOptions
and waitFor*
options.
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 |
---|---|---|---|
prompt |
String | No | |
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. |
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. |
response_format |
Object | No | |
response_format.schema |
Object | No |
Schema for the response format. More information here: https://developers.cloudflare.com/workers-ai/json-mode/ |
response_format.type |
String | Yes | |
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: |
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 |
Possible values:
|
waitForSelector.selector |
String | Yes | |
waitForSelector.visible |
Boolean | No |
Possible 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.