/content - Fetch HTML
Last updated Sep 26, 2026
The /content endpoint instructs the browser to navigate to a website and capture the fully rendered HTML of a page, including the head section, after JavaScript execution. This is ideal for capturing content from JavaScript-heavy or interactive websites.
You can use this endpoint in two ways:
- REST API: Create a custom API Token with
Browser Run - Editpermission. - Workers Bindings: Call the endpoint directly from a Cloudflare Worker using the Workers Bindings. No API token is needed.
For more information, refer to Quick Actions: Before you begin.
Endpoint
https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-run/content
Required fields
You must provide either url or html:
url(string)html(string)
Common use cases
- Capture the fully rendered HTML of a dynamic page
- Extract HTML for parsing, scraping, or downstream processing
Basic usage
Fetch rendered HTML from a URL
Go to https://developers.cloudflare.com/ and return the rendered HTML.
curl -X 'POST' 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-run/content' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <apiToken>' \
-d '{"url": "https://developers.cloudflare.com/"}'
import Cloudflare from "cloudflare";
const client = new Cloudflare({
apiToken: process.env["CLOUDFLARE_API_TOKEN"],
});
const content = await client.browserRendering.content.create({
account_id: process.env["CLOUDFLARE_ACCOUNT_ID"],
url: "https://developers.cloudflare.com/",
});
console.log(content);
interface Env {
BROWSER: BrowserRun;
}
export default {
async fetch(request, env): Promise<Response> {
return await env.BROWSER.quickAction("content", {
url: "https://developers.cloudflare.com/",
});
},
} satisfies ExportedHandler<Env>;
Advanced usage
Looking for more parameters?
Visit the Browser Run API reference for all available parameters, such as setting HTTP credentials using authenticate, setting cookies, and customizing load behavior using gotoOptions.
Block specific resource types
Navigate to https://cloudflare.com/ but block images and stylesheets from loading. Undesired requests can be blocked by resource type (rejectResourceTypes) or by using a regex pattern (rejectRequestPattern). The opposite can also be done, only allow requests that match allowRequestPattern or allowResourceTypes.
curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-run/content' \
-H 'Authorization: Bearer <apiToken>' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://cloudflare.com/",
"rejectResourceTypes": ["image"],
"rejectRequestPattern": ["/^.*\\.(css)"]
}'
Many more options exist, like setting HTTP headers using setExtraHTTPHeaders, setting cookies, and using gotoOptions to control page load behaviour - check the endpoint reference for all available parameters.
Handling JavaScript-heavy pages
For JavaScript-heavy pages or Single Page Applications (SPAs), the default page load behavior may return empty or incomplete results. This happens because the browser considers the page loaded before JavaScript has finished rendering the content.
The simplest solution is to use the gotoOptions.waitUntil parameter set to networkidle0 or networkidle2:
{
"url": "https://example.com",
"gotoOptions": {
"waitUntil": "networkidle0"
}
}
For faster responses, advanced users can use waitForSelector to wait for a specific element instead of waiting for all network activity to stop. This requires knowing which CSS selector indicates the content you need has loaded. For more details, refer to Quick Actions timeouts.
Set a custom user agent
You can change the user agent at the page level by passing userAgent as a top-level parameter in the JSON body. This is useful if the target website serves different content based on the user agent.
Note
The userAgent parameter does not bypass bot protection. Requests from Browser Run will always be identified as a bot. Because the User-Agent is configurable, destination servers looking to identify or block Browser Run requests should use the non-configurable headers rather than relying on the User-Agent string.
Troubleshooting
If you have questions or encounter an error, see the Browser Run FAQ and troubleshooting guide.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/browser-run/quick-actions/content-endpoint/#page","headline":"/content - Fetch HTML","description":"Capture fully rendered HTML from a webpage after JavaScript execution using the Browser Run /content endpoint.","url":"https://developers.cloudflare.com/browser-run/quick-actions/content-endpoint/","inLanguage":"en","image":"https://developers.cloudflare.com/browser-run/quick-actions/content-endpoint/og.png?v=7d85193e517d99e0","dateModified":"2026-09-26","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Scrape and follow links across a website using the Browser Run /crawl endpoint, with configurable depth and output formats. title: /crawl - Crawl web content image: https://developers.cloudflare.com/browser-run/quick-actions/crawl-endpoint/og.png?v=0071d0f11e705093
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/browser-run/llms.txt
Use this file to discover all available pages before exploring further.
Docs