Get 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.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYYAPI Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
X-Auth-Email: user@example.comThe previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194Accepted Permissions (at least one required)
Browser Rendering WriteQuery ParametersExpand Collapse
Body ParametersJSONExpand Collapse
body: object { html, actionTimeout, addScriptTag, 19 more } or object { url, actionTimeout, addScriptTag, 19 more }
object { html, actionTimeout, addScriptTag, 19 more }
Set the content of the page, eg: <h1>Hello World!!</h1>. Either html or url must be set.
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: optional array of object { id, content, type, url } Adds a <script> tag into the page with the desired URL or content.
Adds a <script> tag into the page with the desired URL or content.
addStyleTag: optional array of object { content, url } Adds a <link rel="stylesheet"> tag into the page with the desired URL or a <style type="text/css"> tag with the content.
Adds a <link rel="stylesheet"> tag into the page with the desired URL or a <style type="text/css"> tag with the content.
Only allow requests that match the provided regex patterns, eg. '/^.*.(css)'.
allowResourceTypes: optional array of "document" or "stylesheet" or "image" or 15 moreOnly allow requests that match the provided resource types, eg. 'image' or 'script'.
Only allow requests that match the provided resource types, eg. 'image' or 'script'.
cookies: optional array of object { name, value, domain, 11 more } Check options.
Check options.
custom_ai: optional array of object { authorization, model } Optional list of custom AI models to use for the request. The models will be tried in the order provided, and in case a model returns an error, the next one will be used as fallback.
Optional list of custom AI models to use for the request. The models will be tried in the order provided, and in case a model returns an error, the next one will be used as fallback.
gotoOptions: optional object { referer, referrerPolicy, timeout, waitUntil } Check options.
Check options.
Block undesired requests that match the provided regex patterns, eg. '/^.*.(css)'.
rejectResourceTypes: optional array of "document" or "stylesheet" or "image" or 15 moreBlock undesired requests that match the provided resource types, eg. 'image' or 'script'.
Block undesired requests that match the provided resource types, eg. 'image' or 'script'.
response_format: optional object { type, json_schema }
json_schema: optional map[string or number or boolean or 2 more]Schema for the response format. More information here: https://developers.cloudflare.com/workers-ai/json-mode/.
Schema for the response format. More information here: https://developers.cloudflare.com/workers-ai/json-mode/.
viewport: optional object { height, width, deviceScaleFactor, 3 more } Check options.
Check options.
waitForSelector: optional object { selector, hidden, timeout, visible } Wait for the selector to appear in page. Check options.
Wait for the selector to appear in page. Check options.
object { url, actionTimeout, addScriptTag, 19 more }
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: optional array of object { id, content, type, url } Adds a <script> tag into the page with the desired URL or content.
Adds a <script> tag into the page with the desired URL or content.
addStyleTag: optional array of object { content, url } Adds a <link rel="stylesheet"> tag into the page with the desired URL or a <style type="text/css"> tag with the content.
Adds a <link rel="stylesheet"> tag into the page with the desired URL or a <style type="text/css"> tag with the content.
Only allow requests that match the provided regex patterns, eg. '/^.*.(css)'.
allowResourceTypes: optional array of "document" or "stylesheet" or "image" or 15 moreOnly allow requests that match the provided resource types, eg. 'image' or 'script'.
Only allow requests that match the provided resource types, eg. 'image' or 'script'.
cookies: optional array of object { name, value, domain, 11 more } Check options.
Check options.
custom_ai: optional array of object { authorization, model } Optional list of custom AI models to use for the request. The models will be tried in the order provided, and in case a model returns an error, the next one will be used as fallback.
Optional list of custom AI models to use for the request. The models will be tried in the order provided, and in case a model returns an error, the next one will be used as fallback.
gotoOptions: optional object { referer, referrerPolicy, timeout, waitUntil } Check options.
Check options.
Block undesired requests that match the provided regex patterns, eg. '/^.*.(css)'.
rejectResourceTypes: optional array of "document" or "stylesheet" or "image" or 15 moreBlock undesired requests that match the provided resource types, eg. 'image' or 'script'.
Block undesired requests that match the provided resource types, eg. 'image' or 'script'.
response_format: optional object { type, json_schema }
json_schema: optional map[string or number or boolean or 2 more]Schema for the response format. More information here: https://developers.cloudflare.com/workers-ai/json-mode/.
Schema for the response format. More information here: https://developers.cloudflare.com/workers-ai/json-mode/.
viewport: optional object { height, width, deviceScaleFactor, 3 more } Check options.
Check options.
waitForSelector: optional object { selector, hidden, timeout, visible } Wait for the selector to appear in page. Check options.
Wait for the selector to appear in page. Check options.
Get json.
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/browser-rendering/json \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{
"html": "<h1>Hello World!</h1>"
}'{
"result": {
"foo": {}
},
"success": true,
"errors": [
{
"code": 0,
"message": "message"
}
]
}{
"errors": [
{
"code": 2001,
"message": "Rate limit exceeded"
}
],
"success": false
}Returns Examples
{
"result": {
"foo": {}
},
"success": true,
"errors": [
{
"code": 0,
"message": "message"
}
]
}{
"errors": [
{
"code": 2001,
"message": "Rate limit exceeded"
}
],
"success": false
}