Content API
Fetch fully rendered HTML from a real browser, including JavaScript-rendered content. Send a url to navigate, or html to render inline content.
Endpoint
- Method:
POST - Path:
/content - Auth:
tokenquery parameter (?token=) - Content-Type:
application/json - Response:
text/html
See the OpenAPI reference for complete details.
Quickstart
- cURL
- JavaScript
- Python
- Java
- C#
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/"
}'
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/content?token=${TOKEN}`;
const headers = {
"Cache-Control": "no-cache",
"Content-Type": "application/json"
};
const data = {
url: "https://example.com/"
};
const fetchContent = async () => {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
});
const content = await response.text();
console.log(content);
};
fetchContent();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/content?token={TOKEN}"
headers = {
"Cache-Control": "no-cache",
"Content-Type": "application/json"
}
data = {
"url": "https://example.com/"
}
response = requests.post(url, headers=headers, json=data)
print(response.text)
import java.io.*;
import java.net.http.*;
import java.net.URI;
public class FetchContent {
public static void main(String[] args) {
String TOKEN = "YOUR_API_TOKEN_HERE";
String url = "https://production-sfo.browserless.io/content?token=" + TOKEN;
HttpClient client = HttpClient.newHttpClient();
String jsonData = """
{
"url": "https://example.com/"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Cache-Control", "no-cache")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Response: " + response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}
using System.Text;
using System.Text.Json;
class Program
{
static async Task Main(string[] args)
{
string TOKEN = "YOUR_API_TOKEN_HERE";
string url = $"https://production-sfo.browserless.io/content?token={TOKEN}";
var payload = new
{
url = "https://example.com/"
};
var jsonContent = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json");
using var httpClient = new HttpClient();
try
{
var request = new HttpRequestMessage(HttpMethod.Post, url)
{
Content = jsonContent
};
request.Headers.Add("Cache-Control", "no-cache");
var response = await httpClient.SendAsync(request);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine("Response: " + result);
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
}
}
}
Response
The API returns the fully rendered HTML content as text/html:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example Domain</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body{
background:#eee;
width:60vw;
margin:15vh auto;
font-family:system-ui,sans-serif
}
h1{font-size:1.5em}
div{opacity:0.8}
a:link,a:visited{color:#348}
</style>
</head>
<body>
<div>
<h1>Example Domain</h1>
<p>This domain is for use in documentation examples without needing permission. Avoid use in operations.</p>
<p><a href="https://iana.org/domains/example">Learn more</a></p>
</div>
</body>
</html>
Configuration options
The /content API supports shared request configuration options that apply across REST endpoints:
- Waiting for things: Wait for events, functions, selectors, or timeouts before returning content
- Navigation options: Customize navigation behavior with
gotoOptions - Rejecting undesired requests: Block resources with
rejectResourceTypesandrejectRequestPattern - Continue on error: Use
bestAttemptto continue when async events fail or time out
Bot detection troubleshooting
If content is empty or incomplete, the site may be blocking automation. Signs include:
- Empty HTML response or minimal content
- Partial page content missing key elements
- Different content compared to a regular browser
- Blocked requests or access denied messages
The /unblock API is specifically designed to bypass bot detection mechanisms like Datadome and passive CAPTCHAs. It can return HTML content directly when content: true is set and works best with residential proxies (&proxy=residential).
- cURL
- Javascript
- Python
- Java
- C#
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://example.com/",
"content": true
}'
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/unblock?token=${TOKEN}&proxy=residential`;
const headers = {
"Content-Type": "application/json"
};
const data = {
url: "https://example.com/",
content: true
};
const fetchContent = async () => {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
});
const content = await response.json();
console.log(content);
};
fetchContent();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/unblock?token={TOKEN}&proxy=residential"
headers = {
"Content-Type": "application/json"
}
data = {
"url": "https://example.com/",
"content": True
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
import java.io.*;
import java.net.URI;
import java.net.http.*;
public class FetchUnblockedContent {
public static void main(String[] args) {
String TOKEN = "YOUR_API_TOKEN_HERE";
String url = "https://production-sfo.browserless.io/unblock?token=" + TOKEN + "&proxy=residential";
String jsonData = """
{
"url": "https://example.com/",
"content": true
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Response: " + response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string TOKEN = "YOUR_API_TOKEN_HERE";
string url = $"https://production-sfo.browserless.io/unblock?token={TOKEN}&proxy=residential";
string jsonData = @"
{
""url"": ""https://example.com/"",
""content"": true
}";
using var client = new HttpClient();
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
try
{
var response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine("Response: " + result);
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
For advanced bot detection bypass and complex automation tasks, use BrowserQL.