BrowserHive Capture API (1.0.0)

Download OpenAPI specification:

License: Unlicense

Web page capture API. Submits URLs to capture as PNG/WebP screenshots, HTML, or MHTML (single-file archive). Uses fire-and-forget pattern: requests are accepted immediately and processed asynchronously by the capture coordinator.

Submit a capture request

Accept a capture request for a single URL. Returns 202 immediately on acceptance; the actual capture is processed asynchronously.

The wacz capture format records every HTTP exchange Chromium performs during the capture (including resources loaded later by scroll-triggered lazy loaders) into a WACZ archive replayable in ReplayWeb.page. Server-state dependent traffic — auth flows with expiring tokens, live WebSocket / SSE streams, WebRTC — is not in scope: the WARC records the original exchange but replay cannot reproduce values that change every load.

Filename format

Captured artifacts are uploaded to the configured S3-compatible bucket as s3://<bucket>/[<keyPrefix>/]<filename>. The filename is derived from the task identifiers as follows:

Case Format Example
With labels {taskId}_{labels}.{ext} 550e8400-..._my-label.png
Without labels {taskId}.{ext} 550e8400-....png
Labels + correlationId {taskId}_{correlationId}_{labels}.{ext} 550e8400-..._abc123_my-label.png
correlationId only {taskId}_{correlationId}.{ext} 550e8400-..._abc123.png
Request Body schema: application/json
required
url
required
string <uri> non-empty

Target URL to capture

labels
Array of strings
Default: []

Display labels (used for filename)

correlationId
string

Correlation ID provided by the client for tracking

required
object (CaptureFormats)

Capture format flags. At least one must be true.

acceptLanguage
string [ 1 .. 200 ] characters ^[\x20-\x7e]+$

Value to send as the upstream Accept-Language header for this capture only. Useful for sites whose content varies by language (locale-redirecting corporate top pages, search engines, Wikipedia, etc.).

Format follows IETF BCP 47 quality-list syntax, e.g. ja-JP,ja;q=0.9,en-US;q=0.8,en;q=0.7.

When omitted, no Accept-Language header is set explicitly and the upstream Chromium uses its built-in default (controlled by its --lang startup flag / OS locale).

boolean or DismissSpec (object)

Run banner / modal dismissal before capturing. Removes known consent-management-platform overlays and large fixed/sticky overlays via heuristic.

Two shapes are accepted:

  • booleanfalse (or omitted) skips dismissal entirely; true is equivalent to { "useDefaults": true } (the curated CMP list plus the default heuristic).
  • DismissSpec — inline customization. Use extraSelectors to add page-specific overlay selectors, excludeFrameworks to suppress a noisy default, or heuristic.enabled: false to disable the size/z-index fallback.

When enabled, the server log line for the completed task includes a dismissReport:

{
  "msg": "Task completed",
  "url": "https://www.theguardian.com",
  "dismissReport": {
    "framework": "Sourcepoint",
    "removedSelectors": ["[id^=\"sp_message_container\"]"],
    "removedOverlayCount": 1
  }
}
  • framework — matched CMP name, "custom" when only an extraSelectors entry fired, "heuristic" when only the fallback fired, or null when nothing matched.
  • removedSelectors — exact CSS selectors whose elements were removed in the CMP-selector pass (includes both default-CMP and custom extraSelectors matches).
  • removedOverlayCount — number of elements removed by the heuristic pass (fixed/sticky elements with high z-index covering ≥minViewportCoverageRatio of the viewport, excluding semantic landmarks).

By default best-effort: dismissal failures (in-page evaluate timeout, the page.evaluate promise rejecting, or an invalid CSS selector in extraSelectors raising SyntaxError) are swallowed and the offending entry is skipped, so a malformed page or a typo cannot fail the capture.

Set dismissBanners.failOnError: true to opt out — failures then fail the entire capture (status: "failed" or "timeout" in the worker log) and dismissReport is not present on the result; inspect errorDetails instead. The failure is treated like any other capture failure for retry accounting (consumes one slot of --max-retry-count).

object

Per-request browser viewport in CSS pixels. When provided, page.setViewport is called with these dimensions before navigating to the target URL — useful for sites whose layout varies by viewport size (responsive top pages, mobile-only content) or for capturing at a specific resolution.

When omitted, the server-side default applies (configured via --viewport-width / --viewport-height / BROWSERHIVE_VIEWPORT_*; the built-in default is 1280 × 800).

Bounds (1–7680 × 1–4320) cover up to 8K rendering and exist only as a sanity guard against runaway memory use in Chromium — typical values are 1280 × 800 (desktop default), 1920 × 1080 (Full HD), or 375 × 667 (iPhone SE).

fullPage
boolean

When true, the PNG / WebP screenshot extends below the viewport to capture the full document height (Chromium scrolls and stitches the result). When false or omitted, only the viewport-sized region is captured.

When omitted, the server-side default applies (configured via --screenshot-full-page / BROWSERHIVE_SCREENSHOT_FULL_PAGE; the built-in default is false).

Has no effect on the html / links formats.

boolean or ResetStateSpec (object)

Per-request control of the inter-task wipe applied to the worker's persistent Chromium tab AFTER this capture completes. BrowserHive holds one tab per worker for its entire lifetime, so without a wipe, cookies / DOM listeners / origin-scoped storage from this capture would bleed into whatever task this worker processes next.

Two shapes are accepted:

  • booleantrue forces a full wipe (both axes), false skips the wipe entirely (stateful carry-over). Both ignore server-side defaults.
  • ResetStateSpec — per-axis override; omitted fields fall back to the server-side default (--no-reset-cookies / --no-reset-page-context / BROWSERHIVE_RESET_COOKIES / BROWSERHIVE_RESET_PAGE_CONTEXT).

When omitted, the server-side default applies (built-in default: both axes wipe, matching the long-standing behaviour of clearing state between captures).

See ResetStateSpec for the per-axis semantics and the "two axes, not three" rationale (origin-scoped storage is inseparable from pageContext).

Responses

Request samples

Content type
application/json
Example

Captures The Guardian (which uses Sourcepoint as its consent-management platform). With dismissBanners: true the consent dialog — and any large fixed/sticky overlay caught by the heuristic fallback — are removed before the screenshot is taken. See the dismissBanners field of CaptureRequest for the resulting dismissReport shape.

{
  • "labels": [
    ],
  • "captureFormats": {
    },
  • "dismissBanners": true
}

Response samples

Content type
application/json
{
  • "accepted": true,
  • "taskId": "e6e9d88a-9b63-468a-aec3-b7a11de27af8",
  • "correlationId": "string"
}

Get capture coordinator status

Returns the current status of the queue and worker pool, including a snapshot of pending tasks (head of the queue, capped by pendingLimit).

query Parameters
pendingLimit
integer [ 0 .. 200 ]
Default: 50

Maximum number of pending tasks to include in queue.pendingTasks. Defaults to 50; clamp at 200 to bound the response size.

Responses

Response samples

Content type
application/json
{
  • "pending": 0,
  • "processing": 0,
  • "completed": 0,
  • "operationalWorkers": 0,
  • "totalWorkers": 0,
  • "isRunning": true,
  • "isDegraded": true,
  • "workers": [
    ],
  • "queue": {
    }
}