For the full API schema, see the Fetch API Reference.
Quick Start
1
Install the SDK
npm install @hyperbrowser/sdk
yarn add @hyperbrowser/sdk
pip install hyperbrowser
uv add hyperbrowser
2
Fetch a page
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
const client = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const result = await client.web.fetch({
url: "https://example.com",
});
console.log(result);
import os
from dotenv import load_dotenv
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import FetchParams
load_dotenv()
client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
result = client.web.fetch(
FetchParams(url="https://example.com")
)
print(result)
curl -X POST https://api.hyperbrowser.ai/api/web/fetch \
-H 'Content-Type: application/json' \
-H 'x-api-key: <YOUR_API_KEY>' \
-d '{
"url": "https://example.com",
"outputs": {
"formats": ["markdown", "links"]
}
}'
Response
The response includes ajobId, overall status, and the outputs under data:
{
"jobId": "962372c4-a140-400b-8c26-4ffe21d9fb9c",
"status": "completed",
"data": {
"metadata": {
"title": "Example Domain",
"sourceURL": "https://example.com"
},
"markdown": "# Example Domain\n\nThis domain is for use in illustrative examples...",
"links": [
"https://www.iana.org/domains/example"
]
}
}
Outputs
Useoutputs.formats to specify what data you want returned.
| Output | Description |
|---|---|
markdown | Page content converted to Markdown |
html | Raw HTML of the page |
links | All links found on the page |
screenshot | Screenshot image (configure with options) |
json | Structured data extracted using a JSON Schema, a prompt, or both |
branding | Visual brand profile—colors, fonts, logo, button styles, personality |
outputs.formats cannot contain duplicate output types (e.g. two screenshots).import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
const client = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const result = await client.web.fetch({
url: "https://example.com",
outputs: {
formats: ["markdown", "links"],
},
});
console.log(result.data.markdown);
console.log(result.data.links);
import os
from dotenv import load_dotenv
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import FetchParams, FetchOutputOptions
load_dotenv()
client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
result = client.web.fetch(
FetchParams(
url="https://example.com",
outputs=FetchOutputOptions(
formats=["markdown", "links"]
),
)
)
print(result.data.markdown)
print(result.data.links)
curl -X POST https://api.hyperbrowser.ai/api/web/fetch \
-H 'Content-Type: application/json' \
-H 'x-api-key: <YOUR_API_KEY>' \
-d '{
"url": "https://example.com",
"outputs": {
"formats": ["markdown", "links"]
}
}'
Screenshot with options
Screenshot with options
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
const client = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const result = await client.web.fetch({
url: "https://hackernews.com",
outputs: {
formats: [
"markdown",
{
type: "screenshot",
fullPage: true,
format: "png",
},
],
},
});
console.log(result.data.screenshot);
import os
from dotenv import load_dotenv
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import FetchParams, FetchOutputOptions, FetchOutputScreenshot
load_dotenv()
client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
result = client.web.fetch(
FetchParams(
url="https://hackernews.com",
outputs=FetchOutputOptions(
formats=[
"markdown",
FetchOutputScreenshot(
type="screenshot",
full_page=True,
format="png",
),
]
),
)
)
print(result.data.screenshot)
curl -X POST https://api.hyperbrowser.ai/api/web/fetch \
-H 'Content-Type: application/json' \
-H 'x-api-key: <YOUR_API_KEY>' \
-d '{
"url": "https://hackernews.com",
"outputs": {
"formats": [
"markdown",
{
"type": "screenshot",
"fullPage": true,
"format": "png"
}
]
}
}'
Structured JSON extraction
Structured JSON extraction
Extract structured data from the page using Prompt only (schema auto-generated):Schema only:Both prompt and schema (recommended):
prompt, schema, or both:promptonly — Describe what you want in natural language. A schema is auto-generated from the prompt.schemaonly — Provide a JSON Schema (or Zod/Pydantic equivalent) defining the exact output structure.promptandschema— The schema defines the output structure, while the prompt provides additional guidance for the extraction.
For best results, provide both a
schema and a prompt. The schema defines exactly how you want the data formatted, and the prompt provides context to guide the extraction.import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
const client = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const result = await client.web.fetch({
url: "https://example.com",
outputs: {
formats: [
{
type: "json",
prompt: "Extract the main heading and a brief description of the page",
},
],
},
});
import os
from dotenv import load_dotenv
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import FetchParams, FetchOutputOptions, FetchOutputJson
load_dotenv()
client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
result = client.web.fetch(
FetchParams(
url="https://example.com",
outputs=FetchOutputOptions(
formats=[
FetchOutputJson(
type="json",
prompt="Extract the main heading and a brief description of the page",
)
]
),
)
)
print(result.data.json_)
curl -X POST https://api.hyperbrowser.ai/api/web/fetch \
-H 'Content-Type: application/json' \
-H 'x-api-key: <YOUR_API_KEY>' \
-d '{
"url": "https://example.com",
"outputs": {
"formats": [
{
"type": "json",
"prompt": "Extract the main heading and a brief description of the page"
}
]
}
}'
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
const client = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const result = await client.web.fetch({
url: "https://example.com",
outputs: {
formats: [
{
type: "json",
schema: {
type: "object",
properties: {
heading: { type: "string" },
description: { type: "string" },
},
required: ["heading", "description"],
additionalProperties: false,
},
},
],
},
});
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
import { z } from "zod";
config();
const client = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const PageSchema = z.object({
heading: z.string(),
description: z.string(),
});
const result = await client.web.fetch({
url: "https://example.com",
outputs: {
formats: [
{
type: "json",
schema: PageSchema,
},
],
},
});
import os
from dotenv import load_dotenv
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import FetchParams, FetchOutputOptions, FetchOutputJson
load_dotenv()
client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
result = client.web.fetch(
FetchParams(
url="https://example.com",
outputs=FetchOutputOptions(
formats=[
FetchOutputJson(
type="json",
schema={
"type": "object",
"properties": {
"heading": {"type": "string"},
"description": {"type": "string"},
},
"required": ["heading", "description"],
"additionalProperties": False,
}
)
]
),
)
)
print(result.data.json_)
import os
from dotenv import load_dotenv
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import FetchParams, FetchOutputOptions, FetchOutputJson
from pydantic import BaseModel
load_dotenv()
client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
class PageData(BaseModel):
heading: str
description: str
result = client.web.fetch(
FetchParams(
url="https://example.com",
outputs=FetchOutputOptions(
formats=[FetchOutputJson(
type="json",
schema=PageData
)]
),
)
)
print(result.data.json_)
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
const client = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const result = await client.web.fetch({
url: "https://example.com",
outputs: {
formats: [
{
type: "json",
prompt: "Extract the main heading and a brief description of the page",
schema: {
type: "object",
properties: {
heading: { type: "string" },
description: { type: "string" },
},
required: ["heading", "description"],
additionalProperties: false,
},
},
],
},
});
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
import { z } from "zod";
config();
const client = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const PageSchema = z.object({
heading: z.string(),
description: z.string(),
});
const result = await client.web.fetch({
url: "https://example.com",
outputs: {
formats: [
{
type: "json",
prompt: "Extract the main heading and a brief description of the page",
schema: PageSchema,
},
],
},
});
import os
from dotenv import load_dotenv
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import FetchParams, FetchOutputOptions, FetchOutputJson
load_dotenv()
client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
result = client.web.fetch(
FetchParams(
url="https://example.com",
outputs=FetchOutputOptions(
formats=[
FetchOutputJson(
type="json",
prompt="Extract the main heading and a brief description of the page",
schema={
"type": "object",
"properties": {
"heading": {"type": "string"},
"description": {"type": "string"},
},
"required": ["heading", "description"],
"additionalProperties": False,
}
)
]
),
)
)
print(result.data.json_)
import os
from dotenv import load_dotenv
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import FetchParams, FetchOutputOptions, FetchOutputJson
from pydantic import BaseModel
load_dotenv()
client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
class PageData(BaseModel):
heading: str
description: str
result = client.web.fetch(
FetchParams(
url="https://example.com",
outputs=FetchOutputOptions(
formats=[
FetchOutputJson(
type="json",
prompt="Extract the main heading and a brief description of the page",
schema=PageData,
)
]
),
)
)
print(result.data.json_)
Node SDK: You can pass a Zod schema directly to the
schema field, and it will be automatically converted to JSON Schema.Python SDK: You can pass a Pydantic model class directly to the schema field, and it will be automatically converted to JSON Schema.Screenshot cropping rules:
fullPageandcropToContentare mutually exclusive.- If both
cropToContentMaxHeightandcropToContentMinHeightare set, max must be ≥ min. - Crop dimensions must be between 100 and 8000 pixels.
Branding profile
Branding profile
Extract a structured brand profile for the page: color roles (primary, secondary, accent, background, text), typography, logo + favicon, primary/secondary button styles, personality, and confidence scores. Combines in-browser DOM analysis with an LLM pass over the detected elements.The response
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
async function main() {
const client = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const result = await client.web.fetch({
url: "https://stripe.com",
outputs: {
formats: ["branding"],
},
});
console.log(result.data?.branding?.colors?.primary);
console.log(result.data?.branding?.images?.logo);
console.log(result.data?.branding?.personality?.tone);
}
main().catch(console.error);
import os
from dotenv import load_dotenv
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import FetchParams, FetchOutputOptions
load_dotenv()
client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
result = client.web.fetch(
FetchParams(
url="https://stripe.com",
outputs=FetchOutputOptions(formats=["branding"]),
)
)
branding = result.data.branding if result.data else None
if branding:
if branding.colors:
print(branding.colors.primary)
if branding.images:
print(branding.images.logo)
if branding.personality:
print(branding.personality.tone)
curl -X POST https://api.hyperbrowser.ai/api/web/fetch \
-H 'Content-Type: application/json' \
-H 'x-api-key: <YOUR_API_KEY>' \
-d '{
"url": "https://stripe.com",
"outputs": {
"formats": ["branding"]
}
}'
data.branding object includes:| Field | Description |
|---|---|
colorScheme | "light" or "dark" |
colors | primary, secondary, accent, background, textPrimary, … |
fonts | Cleaned brand fonts with roles (heading, body, monospace, …) |
typography | fontFamilies, fontStacks, fontSizes |
spacing | baseUnit, borderRadius |
components | buttonPrimary, buttonSecondary, input — full CSS style objects |
images | logo, logoHref, logoAlt, favicon, ogImage |
personality | tone, energy, targetAudience |
designSystem | framework (tailwind, bootstrap, …), componentLibrary |
confidence | buttons, colors, overall (0–1) |
Branding works identically in Crawl — each crawled page gets its own
branding profile.Output Controls
Control what gets extracted and returned:| Field | Type | Default | Description |
|---|---|---|---|
outputs.sanitize | string | "none" | Sanitize mode: "none", "basic", or "advanced" |
outputs.includeSelectors | string[] | [] | CSS selectors to include (only matching elements returned) |
outputs.excludeSelectors | string[] | [] | CSS selectors to exclude from output |
outputs.storageState | object | — | Pre-seed localStorage/sessionStorage before fetching |
Example with selectors, storageState, navigation, and cache
Example with selectors, storageState, navigation, and cache
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
const client = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const result = await client.web.fetch({
url: "https://example.com",
outputs: {
formats: ["html"],
excludeSelectors: ["nav", "footer", "aside"],
storageState: {
localStorage: {
"example:key": "example:value",
},
},
},
navigation: {
waitUntil: "load",
waitFor: 2000,
},
cache: {
maxAgeSeconds: 3600,
},
});
import os
from dotenv import load_dotenv
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import (
FetchParams,
FetchOutputOptions,
FetchNavigationOptions,
FetchCacheOptions,
FetchStorageStateOptions,
)
load_dotenv()
client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
result = client.web.fetch(
FetchParams(
url="https://example.com",
outputs=FetchOutputOptions(
formats=["html"],
exclude_selectors=["nav", "footer", "aside"],
storage_state=FetchStorageStateOptions(
local_storage={"example:key": "example:value"}
),
),
navigation=FetchNavigationOptions(
wait_until="load", wait_for=2000
),
cache=FetchCacheOptions(max_age_seconds=3600),
)
)
print(result)
curl -X POST https://api.hyperbrowser.ai/api/web/fetch \
-H 'Content-Type: application/json' \
-H 'x-api-key: <YOUR_API_KEY>' \
-d '{
"url": "https://example.com",
"outputs": {
"formats": ["html"],
"excludeSelectors": ["nav", "footer", "aside"],
"storageState": {
"localStorage": {
"example:key": "example:value"
}
}
},
"navigation": {
"waitUntil": "load",
"waitFor": 2000
},
"cache": {
"maxAgeSeconds": 3600
}
}'
Browser & Stealth
Configure how the cloud browser runs:| Field | Type | Default | Description |
|---|---|---|---|
stealth | string | "auto" | Stealth mode: "none", "auto", or "ultra" (recommended: "auto" or "ultra") |
browser.profileId | string | — | Reuse an existing browser profile |
browser.solveCaptchas | boolean | false | Enable CAPTCHA solving |
browser.screen | object | { width: 1280, height: 720 } | Set viewport dimensions (width, height) |
browser.location | object | — | Localize via proxy location (country, state, city). If set, proxy is enabled automatically |
Navigation Controls
Control page load behavior and timing:| Field | Type | Default | Description |
|---|---|---|---|
navigation.waitUntil | string | "domcontentloaded" | Load condition: "load", "domcontentloaded", or "networkidle" |
navigation.waitFor | number | 0 | Milliseconds to wait after navigation completes before collecting outputs (0–30000) |
navigation.timeoutMs | number | 30000 | Max time (ms) to wait for navigation (1–60000) |
Cache Controls
Control caching behavior for fetch results:| Field | Type | Default | Description |
|---|---|---|---|
cache.maxAgeSeconds | number | — | Cache control—cached results older than this are treated as stale. Set to 0 to bypass cache reads |
Using cache can improve response times for frequently accessed pages. Set
maxAgeSeconds based on how fresh you need the data to be.