Fetch a web page with X402 payment
curl --request POST \
--url https://api.hyperbrowser.ai/x402/web/fetch \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"outputs": {
"formats": [
{
"type": "markdown"
}
],
"includeSelectors": [
"<string>"
],
"excludeSelectors": [
"<string>"
],
"storageState": {
"localStorage": {},
"sessionStorage": {}
}
},
"browser": {
"screen": {
"width": 1280,
"height": 720
},
"profileId": "<string>",
"solveCaptchas": "<string>",
"location": {
"country": "<string>",
"state": "<string>",
"city": "<string>"
}
},
"navigation": {
"timeoutMs": 123,
"waitFor": 123
},
"cache": {
"maxAgeSeconds": 123
}
}
'import requests
url = "https://api.hyperbrowser.ai/x402/web/fetch"
payload = {
"url": "<string>",
"outputs": {
"formats": [{ "type": "markdown" }],
"includeSelectors": ["<string>"],
"excludeSelectors": ["<string>"],
"storageState": {
"localStorage": {},
"sessionStorage": {}
}
},
"browser": {
"screen": {
"width": 1280,
"height": 720
},
"profileId": "<string>",
"solveCaptchas": "<string>",
"location": {
"country": "<string>",
"state": "<string>",
"city": "<string>"
}
},
"navigation": {
"timeoutMs": 123,
"waitFor": 123
},
"cache": { "maxAgeSeconds": 123 }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
outputs: {
formats: [{type: 'markdown'}],
includeSelectors: ['<string>'],
excludeSelectors: ['<string>'],
storageState: {localStorage: {}, sessionStorage: {}}
},
browser: {
screen: {width: 1280, height: 720},
profileId: '<string>',
solveCaptchas: '<string>',
location: {country: '<string>', state: '<string>', city: '<string>'}
},
navigation: {timeoutMs: 123, waitFor: 123},
cache: {maxAgeSeconds: 123}
})
};
fetch('https://api.hyperbrowser.ai/x402/web/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperbrowser.ai/x402/web/fetch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'outputs' => [
'formats' => [
[
'type' => 'markdown'
]
],
'includeSelectors' => [
'<string>'
],
'excludeSelectors' => [
'<string>'
],
'storageState' => [
'localStorage' => [
],
'sessionStorage' => [
]
]
],
'browser' => [
'screen' => [
'width' => 1280,
'height' => 720
],
'profileId' => '<string>',
'solveCaptchas' => '<string>',
'location' => [
'country' => '<string>',
'state' => '<string>',
'city' => '<string>'
]
],
'navigation' => [
'timeoutMs' => 123,
'waitFor' => 123
],
'cache' => [
'maxAgeSeconds' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hyperbrowser.ai/x402/web/fetch"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"outputs\": {\n \"formats\": [\n {\n \"type\": \"markdown\"\n }\n ],\n \"includeSelectors\": [\n \"<string>\"\n ],\n \"excludeSelectors\": [\n \"<string>\"\n ],\n \"storageState\": {\n \"localStorage\": {},\n \"sessionStorage\": {}\n }\n },\n \"browser\": {\n \"screen\": {\n \"width\": 1280,\n \"height\": 720\n },\n \"profileId\": \"<string>\",\n \"solveCaptchas\": \"<string>\",\n \"location\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"city\": \"<string>\"\n }\n },\n \"navigation\": {\n \"timeoutMs\": 123,\n \"waitFor\": 123\n },\n \"cache\": {\n \"maxAgeSeconds\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hyperbrowser.ai/x402/web/fetch")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"outputs\": {\n \"formats\": [\n {\n \"type\": \"markdown\"\n }\n ],\n \"includeSelectors\": [\n \"<string>\"\n ],\n \"excludeSelectors\": [\n \"<string>\"\n ],\n \"storageState\": {\n \"localStorage\": {},\n \"sessionStorage\": {}\n }\n },\n \"browser\": {\n \"screen\": {\n \"width\": 1280,\n \"height\": 720\n },\n \"profileId\": \"<string>\",\n \"solveCaptchas\": \"<string>\",\n \"location\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"city\": \"<string>\"\n }\n },\n \"navigation\": {\n \"timeoutMs\": 123,\n \"waitFor\": 123\n },\n \"cache\": {\n \"maxAgeSeconds\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperbrowser.ai/x402/web/fetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"outputs\": {\n \"formats\": [\n {\n \"type\": \"markdown\"\n }\n ],\n \"includeSelectors\": [\n \"<string>\"\n ],\n \"excludeSelectors\": [\n \"<string>\"\n ],\n \"storageState\": {\n \"localStorage\": {},\n \"sessionStorage\": {}\n }\n },\n \"browser\": {\n \"screen\": {\n \"width\": 1280,\n \"height\": 720\n },\n \"profileId\": \"<string>\",\n \"solveCaptchas\": \"<string>\",\n \"location\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"city\": \"<string>\"\n }\n },\n \"navigation\": {\n \"timeoutMs\": 123,\n \"waitFor\": 123\n },\n \"cache\": {\n \"maxAgeSeconds\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"jobId": "<string>",
"error": "<string>",
"data": {
"metadata": {},
"html": "<string>",
"markdown": "<string>",
"links": [
"<string>"
],
"screenshot": "<string>",
"json": {},
"branding": {
"colorScheme": "<string>",
"colors": {},
"fonts": [
{
"family": "<string>",
"role": "<string>"
}
],
"typography": {},
"spacing": {},
"components": {},
"images": {},
"personality": {},
"designSystem": {},
"confidence": {}
}
}
}{
"message": "<string>"
}{}{
"message": "<string>"
}X402
Fetch a web page with X402 payment
X402 payment endpoint. First request returns 402 with payment requirements. Retry with PAYMENT-SIGNATURE header containing cryptographic proof to get the actual data. See https://x402.gitbook.io/x402 for protocol details.
POST
/
x402
/
web
/
fetch
Fetch a web page with X402 payment
curl --request POST \
--url https://api.hyperbrowser.ai/x402/web/fetch \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"outputs": {
"formats": [
{
"type": "markdown"
}
],
"includeSelectors": [
"<string>"
],
"excludeSelectors": [
"<string>"
],
"storageState": {
"localStorage": {},
"sessionStorage": {}
}
},
"browser": {
"screen": {
"width": 1280,
"height": 720
},
"profileId": "<string>",
"solveCaptchas": "<string>",
"location": {
"country": "<string>",
"state": "<string>",
"city": "<string>"
}
},
"navigation": {
"timeoutMs": 123,
"waitFor": 123
},
"cache": {
"maxAgeSeconds": 123
}
}
'import requests
url = "https://api.hyperbrowser.ai/x402/web/fetch"
payload = {
"url": "<string>",
"outputs": {
"formats": [{ "type": "markdown" }],
"includeSelectors": ["<string>"],
"excludeSelectors": ["<string>"],
"storageState": {
"localStorage": {},
"sessionStorage": {}
}
},
"browser": {
"screen": {
"width": 1280,
"height": 720
},
"profileId": "<string>",
"solveCaptchas": "<string>",
"location": {
"country": "<string>",
"state": "<string>",
"city": "<string>"
}
},
"navigation": {
"timeoutMs": 123,
"waitFor": 123
},
"cache": { "maxAgeSeconds": 123 }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
outputs: {
formats: [{type: 'markdown'}],
includeSelectors: ['<string>'],
excludeSelectors: ['<string>'],
storageState: {localStorage: {}, sessionStorage: {}}
},
browser: {
screen: {width: 1280, height: 720},
profileId: '<string>',
solveCaptchas: '<string>',
location: {country: '<string>', state: '<string>', city: '<string>'}
},
navigation: {timeoutMs: 123, waitFor: 123},
cache: {maxAgeSeconds: 123}
})
};
fetch('https://api.hyperbrowser.ai/x402/web/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperbrowser.ai/x402/web/fetch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'outputs' => [
'formats' => [
[
'type' => 'markdown'
]
],
'includeSelectors' => [
'<string>'
],
'excludeSelectors' => [
'<string>'
],
'storageState' => [
'localStorage' => [
],
'sessionStorage' => [
]
]
],
'browser' => [
'screen' => [
'width' => 1280,
'height' => 720
],
'profileId' => '<string>',
'solveCaptchas' => '<string>',
'location' => [
'country' => '<string>',
'state' => '<string>',
'city' => '<string>'
]
],
'navigation' => [
'timeoutMs' => 123,
'waitFor' => 123
],
'cache' => [
'maxAgeSeconds' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hyperbrowser.ai/x402/web/fetch"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"outputs\": {\n \"formats\": [\n {\n \"type\": \"markdown\"\n }\n ],\n \"includeSelectors\": [\n \"<string>\"\n ],\n \"excludeSelectors\": [\n \"<string>\"\n ],\n \"storageState\": {\n \"localStorage\": {},\n \"sessionStorage\": {}\n }\n },\n \"browser\": {\n \"screen\": {\n \"width\": 1280,\n \"height\": 720\n },\n \"profileId\": \"<string>\",\n \"solveCaptchas\": \"<string>\",\n \"location\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"city\": \"<string>\"\n }\n },\n \"navigation\": {\n \"timeoutMs\": 123,\n \"waitFor\": 123\n },\n \"cache\": {\n \"maxAgeSeconds\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hyperbrowser.ai/x402/web/fetch")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"outputs\": {\n \"formats\": [\n {\n \"type\": \"markdown\"\n }\n ],\n \"includeSelectors\": [\n \"<string>\"\n ],\n \"excludeSelectors\": [\n \"<string>\"\n ],\n \"storageState\": {\n \"localStorage\": {},\n \"sessionStorage\": {}\n }\n },\n \"browser\": {\n \"screen\": {\n \"width\": 1280,\n \"height\": 720\n },\n \"profileId\": \"<string>\",\n \"solveCaptchas\": \"<string>\",\n \"location\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"city\": \"<string>\"\n }\n },\n \"navigation\": {\n \"timeoutMs\": 123,\n \"waitFor\": 123\n },\n \"cache\": {\n \"maxAgeSeconds\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperbrowser.ai/x402/web/fetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"outputs\": {\n \"formats\": [\n {\n \"type\": \"markdown\"\n }\n ],\n \"includeSelectors\": [\n \"<string>\"\n ],\n \"excludeSelectors\": [\n \"<string>\"\n ],\n \"storageState\": {\n \"localStorage\": {},\n \"sessionStorage\": {}\n }\n },\n \"browser\": {\n \"screen\": {\n \"width\": 1280,\n \"height\": 720\n },\n \"profileId\": \"<string>\",\n \"solveCaptchas\": \"<string>\",\n \"location\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"city\": \"<string>\"\n }\n },\n \"navigation\": {\n \"timeoutMs\": 123,\n \"waitFor\": 123\n },\n \"cache\": {\n \"maxAgeSeconds\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"jobId": "<string>",
"error": "<string>",
"data": {
"metadata": {},
"html": "<string>",
"markdown": "<string>",
"links": [
"<string>"
],
"screenshot": "<string>",
"json": {},
"branding": {
"colorScheme": "<string>",
"colors": {},
"fonts": [
{
"family": "<string>",
"role": "<string>"
}
],
"typography": {},
"spacing": {},
"components": {},
"images": {},
"personality": {},
"designSystem": {},
"confidence": {}
}
}
}{
"message": "<string>"
}{}{
"message": "<string>"
}Headers
Base64-encoded JSON containing payment proof (x402Version, resource, accepted payment method, and cryptographic payload with signature and payer address)
Body
application/json
Was this page helpful?
⌘I