browser-gateway

Cloud Data API

One-shot screenshots, page content, and structured scraping over HTTPS. No client library required.

What it is

Three HTTPS endpoints on cdp.browsergateway.io that return page data directly, without a Puppeteer or Playwright client. Point curl at them and you get back an image, a markdown document, or a JSON object of selector matches.

EndpointReturnsBody cap
POST /v1/screenshotRaw image bytes (PNG or JPEG)25 MB
POST /v1/contentJSON with page content in one or more formats10 MB
POST /v1/scrapeJSON with CSS-selector matches, optional formats and screenshot5 MB

Every successful call counts as one BYOK session against your monthly ceiling (10,000 sessions per month, free). Errors (4xx and 5xx responses) never count. Above the ceiling each session drains $0.0005 from wallet.

This is a distinct surface from two others on the platform:

SurfaceBase URLAuthPurpose
Cloud Data API (this page)https://cdp.browsergateway.io/v1Router key Bearer bg_...One-shot browser actions
Cloud CDP endpointwss://cdp.browsergateway.io/v1/connect?token=bg_...Router key in query stringFull CDP session for Puppeteer / Playwright
Cloud Control APIhttps://app-api.browsergateway.com/v1Account token Bearer bga_...Manage workspaces, providers, billing

The router key and the account token are separate systems. The router key powers CDP + Data API; the account token powers the control-plane API.

Auth

Every request carries the router key in the Authorization header:

curl -X POST "https://cdp.browsergateway.io/v1/screenshot" \
  -H "Authorization: Bearer bg_YOUR_ROUTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

Alternatively, pass the key as ?token=:

curl -X POST "https://cdp.browsergateway.io/v1/screenshot?token=bg_YOUR_ROUTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

The router key is the same one you paste into Puppeteer or Playwright for CDP connections. Find it on the Keys page in the dashboard.

Billing

Every successful call = one BYOK session. First 10,000 sessions per month are free across your workspace (CDP + Data API combined). Overage draws $0.0005 per session from wallet.

ResponseMeaningCounts as session?
200SuccessYes
400Validation error or provider not configuredNo
402Over ceiling, wallet emptyNo — call rejected before browser spawn
40830-second wall-clock timeoutNo
413Response body exceeded the endpoint capNo
503No provider available (all in cooldown or at capacity)No

Data API calls share the same monthly ceiling as /v1/connect CDP sessions. Pick whichever interface fits your code — the meter treats them identically.

/v1/screenshot

Capture a screenshot of any URL as PNG or JPEG. Response body is raw image bytes.

curl -X POST "https://cdp.browsergateway.io/v1/screenshot" \
  -H "Authorization: Bearer bg_..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "format": "png",
    "fullPage": true,
    "viewport": { "width": 1440, "height": 900 }
  }' \
  --output screenshot.png

Request body:

FieldTypeDefaultNotes
urlstringrequiredFully qualified URL to load
format"png" | "jpeg""png"Image format
fullPagebooleanfalseScroll and capture the entire scrollable area
viewport{width, height}{1280, 720}Browser viewport
qualitynumber 0-100JPEG only
selectorstringCapture the first element matching this CSS selector
clip{x, y, width, height}Capture only a region
omitBackgroundbooleanfalseTransparent background (PNG only)
scrollPagebooleanfalseScroll through before capture to trigger lazy loading
waitUntilstring"domcontentloaded"load, domcontentloaded, networkidle, commit
waitForSelectorstringWait for this selector after navigation (10 s cap)
waitForTimeoutnumberExtra ms to wait after load (0 to 30000)
timeoutnumber30000Total navigation timeout (1000–60000)
headersobjectExtra HTTP request headers
userAgentstringOverride the browser's user agent

Response headers:

  • Content-Type: image/png or image/jpeg
  • X-Response-Code: upstream HTTP status of the navigated page
  • X-Response-URL: final URL after any redirects
  • X-Timing-Total-Ms: end-to-end wall clock
  • X-Timing-Navigation-Ms: time spent on page.goto

/v1/content

Fetch a page and return its content in one or more formats. Useful for AI agents that want clean text or markdown.

curl -X POST "https://cdp.browsergateway.io/v1/content" \
  -H "Authorization: Bearer bg_..." \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com", "formats": ["markdown", "text"] }'

Request-body fields extend the screenshot base with:

FieldTypeDefaultNotes
formatsstring[]["markdown"]Any combination of html, markdown, text, readability

Response shape:

{
  "success": true,
  "data": {
    "url": "https://example.com/",
    "statusCode": 200,
    "content": {
      "markdown": "# Example Domain\n\nThis domain is for use...",
      "text": "Example Domain\n\nThis domain is for use..."
    },
    "metadata": {
      "title": "Example Domain",
      "description": "..."
    },
    "links": [
      { "url": "https://www.iana.org/domains/example", "text": "More information..." }
    ]
  },
  "timings": { "total": 432, "navigation": 380, "action": 52 }
}

readability runs the page through a Readability-style extractor (removes chrome, isolates the main article). markdown runs the extractor with markdown output. html returns raw serialized HTML. text returns document.body.innerText.

/v1/scrape

Extract structured data using CSS selectors. Optionally combines selector results with page content and a screenshot in one round-trip.

curl -X POST "https://cdp.browsergateway.io/v1/scrape" \
  -H "Authorization: Bearer bg_..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "selectors": [
      { "name": "title", "selector": "h1" },
      { "name": "links", "selector": "a", "attribute": "href" }
    ],
    "formats": ["markdown"]
  }'

Additional request-body fields:

FieldTypeNotes
selectorsarray<{name, selector, attribute?}>Named CSS queries. Each returns matches with text + outer HTML, optionally an attribute value
formatsstring[]Also return page content in the requested formats
screenshotbooleanAlso return a base64-encoded JPEG screenshot

Either selectors or formats (or both) must be provided.

Response shape:

{
  "success": true,
  "data": {
    "url": "https://example.com/",
    "statusCode": 200,
    "selectors": [
      {
        "name": "title",
        "selector": "h1",
        "results": [{ "text": "Example Domain", "html": "<h1>Example Domain</h1>" }]
      }
    ],
    "content": { "markdown": "# Example Domain..." }
  },
  "timings": { "total": 380, "navigation": 350, "action": 30 }
}

Profile support

All three endpoints accept an optional profile field. When set, the request runs with the saved cookies and localStorage of that profile, and captures the latest state on success. Retries are disabled when a profile is pinned (one-shot; retries could double-commit state).

{
  "url": "https://app.example.com/dashboard",
  "profile": "acme-user-123"
}

Profile pinning requires the workspace to have profiles enabled and the requested profile to exist. If the profile is locked by another concurrent session, the response is HTTP 409.

Provider pinning

Pass provider to route the request to one specific backend (no failover):

{
  "url": "https://example.com",
  "provider": "browserserve-eu"
}

If the pinned provider is in cooldown or at capacity, the response is HTTP 503 with no failover attempted.

Try it from the dashboard

The REST API page in the dashboard has an interactive form for each of the three endpoints, autofilled with your active router key.

On this page