Skip to main content

/content API

The content API allows for simple navigation to a site and capturing the page's content (including the <head> section). Browserless will respond with a Content-Type of text/html, and string of the site's HTML after it has been rendered and evaluated inside the browser. This is useful for capturing the content of a page that has a lot of JavaScript or other interactivity.

You can check the full Open API schema here.

BrowserQL

We recommend using BrowserQL, Browserless' first-class browser automation API, to capture content from any website to be used in complex browser automation tasks.

Example

curl -X POST \
"https://production-sfo.browserless.io/content?token=YOUR_API_TOKEN_HERE" \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com/"
}'

Additional Configuration Options

The /content API supports additional configuration options that are shared across multiple REST API endpoints. See the Request Configuration page for detailed documentation on:

  • Waiting for Things: Wait for events, functions, selectors, or timeouts before returning the response
  • Navigation Options: Customize navigation behavior using gotoOptions
  • Rejecting Undesired Requests: Block specific resources using rejectResourceTypes and rejectRequestPattern
  • Continue on Error: Use bestAttempt to proceed when async events fail or timeout

Bot Detection Troubleshooting

If you're experiencing issues with the /content API returning no data or partial data, this is typically due to bot detection mechanisms employed by the target website. Websites may use various techniques to detect and block automated browsers, which can result in empty responses or incomplete content.

Recognising failures from Anti Bot Mechanisms

  • Empty HTML response or minimal content
  • Partial page content missing key elements
  • Different content compared to what you see in a regular browser
  • Blocked requests or access denied messages

Alternative: Unblock API

When encountering bot detection issues, we recommend using the /unblock API as an alternative to the /content API. The /unblock endpoint is specifically designed to bypass bot detection mechanisms and can return HTML content directly in the response.

curl --request POST \
--url 'https://production-sfo.browserless.io/unblock?token=YOUR_API_TOKEN_HERE&proxy=residential' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://www.example.com/",
"browserWSEndpoint": false,
"cookies": false,
"content": true,
"screenshot": false
}'

The /unblock API is suitable for more adavanced bot detection bypass use-cases similar to:

  • Specialized unblocking: Designed specifically to bypass bot detection mechanisms like Datadome and passive CAPTCHAs
  • Direct content return: Returns HTML content directly in the response when content: true is set
  • Enhanced success rate: Works best when combined with residential proxies (&proxy=residential)
  • Simple integration: Provides the same content extraction functionality as the /content API

For more information about the /unblock API and its capabilities, see the /unblock API documentation.