Browser To API
BrowserbaseOfficialPublished by Browserbase
- Skill
- Content generator
- Software development
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
Browser to API is a post-processing workflow that transforms recorded browser network traffic into structured OpenAPI 3.1 documentation. By analyzing CDP event logs and optional network body captures, it infers API schemas, templates URL paths, and decomposes multiplexed endpoints like GraphQL. The tool produces a comprehensive suite of artifacts, including a machine-readable YAML/JSON spec, a zero-dependency client, and a self-contained HTML report for visualizing discovered operations.
What it does
- Parses browser-trace network logs to reconstruct API activity.
- Infers JSON schemas from observed request and response bodies.
- Automatically templates URL paths by identifying dynamic segments like UUIDs.
- Decomposes multiplexed endpoints such as GraphQL into distinct logical operations.
- Filters out common infrastructure noise like analytics, tracking, and bot defense traffic.
- Generates a self-contained HTML report and a ready-to-use client.mjs file.
When to use it
- You need to document an undocumented or third-party website API.
- You are building a client or SDK for a service that lacks a public API specification.
- You want to generate an OpenAPI spec based on real-world usage patterns.
- You need to analyze which API endpoints are triggered by specific browser flows.
Advantages
- Creates specifications based on actual observed traffic rather than assumptions.
- Provides a visual, interactive report for easy exploration of discovered endpoints.
- Includes automatic noise reduction to focus on relevant API traffic.
- Supports complex dispatch patterns like GraphQL and JSON-RPC.
- Generates a functional client snippet alongside the documentation.
Usage examples
- “Generate an OpenAPI spec from my recent browser-trace run.”
- The skill processes the .o11y/run-name directory and outputs an openapi.yaml, a client.mjs file, and an index.html report.
- “I only want to document the API endpoints for api.example.com.”
- The skill uses the --origins flag to filter out noise from other domains, resulting in a cleaner, more focused specification.
- “How can I get response body schemas in my generated spec?”
- The skill explains that you must use the browser-trace network capture feature and pass the resulting directory to the --bodies flag during generation.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/browserbase/browser-to-api/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip browser-to-api.zip -d .agents/skills
Documentation by Browserbase
Browser to API
Replay-driven API discovery. Consume a browser-trace capture, pair its CDP request / response events, templatize observed URLs, infer JSON schemas from samples, and emit an OpenAPI 3.1 document plus a human-readable coverage report.
This skill does not capture traffic. It is purely offline post-processing on top of browser-trace's cdp/network/*.jsonl buckets. The two skills compose:
browser-trace → .o11y/<run>/cdp/network/{requests,responses}.jsonl
browser-to-api → .o11y/<run>/api-spec/index.html + openapi.yaml + client.mjsWhen to use
The user wants an OpenAPI document for a third-party or undocumented website API.
The user has a
browser-tracerun and wants endpoints + schemas extracted from it.The user is building a client/SDK against a site that doesn't publish a spec.
The user wants a coverage report showing which flows would broaden the spec.
If the user wants to capture traffic, send them to browser-trace first.
Two-step workflow
1. Capture with browser-trace (and optionally bodies via browse network on)
# Local example against an existing debuggable Chrome target
TARGET=9222
node ../browser-trace/scripts/start-capture.mjs "$TARGET" my-site
browse open about:blank --cdp "$TARGET"
browse network on # capture request/response bodies
browse open https://example.com
# ...drive whatever flows you want covered...
# Snapshot the bodies dir BEFORE turning capture off (the temp dir is shared
# per-session, so subsequent `browse network on` runs would mix your bodies
# with whatever a future capture writes if you skip this step).
cp -r "$(browse network path | jq -r .path)" .o11y/my-site/cdp/network/bodies/
browse network off
node ../browser-trace/scripts/stop-capture.mjs my-site
node ../browser-trace/scripts/bisect-cdp.mjs my-sitebrowse network on is optional but strongly recommended — without it, the spec has no response-body schemas (the CDP firehose used by browse cdp does not embed bodies). With it, both request bodies (already captured by CDP) and response bodies are joined into the trace by CDP requestId.
2. Generate the spec
node scripts/discover.mjs --run .o11y/my-site
# → .o11y/my-site/api-spec/index.html ← open this
# .o11y/my-site/api-spec/client.mjs
# .o11y/my-site/api-spec/openapi.yaml
# .o11y/my-site/api-spec/openapi.json
# .o11y/my-site/api-spec/report.md
# .o11y/my-site/api-spec/confidence.json
# .o11y/my-site/api-spec/samples/*.json
# .o11y/my-site/api-spec/intermediate/*.jsonldiscover.mjs auto-detects <run>/cdp/network/bodies/. To use a body capture from elsewhere (e.g. didn't snapshot, want the live browse network dir), pass --bodies <path> explicitly.
3. Open the HTML report
After discover.mjs finishes, always open the generated HTML report:
open .o11y/my-site/api-spec/index.htmlThe report is a self-contained HTML file (no server needed) that shows each discovered operation as an expandable card with variables, client usage, request/response examples, and a generated client.mjs snippet at the bottom. This is the primary deliverable — always open it for the user.
CLI flags
| Flag | Required | Meaning |
|---|---|---|
--run <path> | yes | Path to a browser-trace run directory |
--out <path> | no | Output dir; default <run>/api-spec/ |
--bodies <path> | no | browse network capture dir to join into the trace (auto-detected from <run>/cdp/network/bodies/ when present) |
--include <regex> | no | Only include URLs matching regex (repeatable) |
--exclude <regex> | no | Exclude URLs matching regex (repeatable; in addition to defaults) |
--origins <list> | no | Comma-separated origin allow-list (e.g. api.example.com,example.com) |
--format <yaml|json|both> | no | Output format. Default both |
--title <string> | no | OpenAPI info.title. Default derived from primary origin |
--redact <list> | no | Extra header names / JSON keys to redact (comma-separated) |
--min-samples <n> | no | Minimum samples per endpoint to include. Default 1 |
--stage <name> | no | Run only one stage: load, filter, normalize, infer, emit |
Output layout
<run>/api-spec/
├── index.html visual report — open this (self-contained, no server)
├── client.mjs zero-dep fetch client with typed functions per operation
├── openapi.yaml machine-readable spec
├── openapi.json mirror
├── report.md markdown summary + curl examples
├── confidence.json per-endpoint confidence + normalization flags
├── samples/ redacted request/response examples
│ └── <method>__<path-hash>.json
└── intermediate/ pipeline byproducts (paired/filtered/endpoints jsonl)What you get from browse cdp and browse network
Two complementary capture sources:
| Source | Provides | Limitation |
|---|---|---|
browse cdp (used by browser-trace) | request method/URL/headers/postData, response status/headers/mimeType, full event timing | Does not embed response bodies. Bodies must be pulled with Network.getResponseBody, which the firehose doesn't do. |
browse network on (separate command) | request bodies AND response bodies on disk, keyed by CDP requestId | Capture dir is shared per browse session; snapshot before another browse network on overwrites it. |
discover.mjs will pull bodies from a browse network dir if you pass --bodies <path> (or stash them under <run>/cdp/network/bodies/, which is auto-detected). The matching is by requestId — browse network writes that into each request.json as id, and we join directly.
What changes when bodies are present:
✅ Path templating, query-param schemas, status codes, content-types — same either way.
✅ Request-body schemas —
postDatafrom CDP is enough; bodies dir is a nice-to-have for non-postDatacases.✅ Response-body schemas — fully inferred from real samples. Without bodies you get
{ description, content: <mimeType> }skeletons.
The report flags every endpoint that has no response-body sample.
Automatic noise filtering
The normalize stage automatically classifies and drops infrastructure noise:
Tracking / analytics — paths containing
/track,/pixel,/beacon,/impression,/pageview,/dag/v*Bot defense — Akamai (
/akam/), fingerprint payloads (sensor_data), obfuscated multi-segment pathsSession plumbing —
/session,/authenticate/start, cookie consent, A/B experiment endpointsHTML page renders —
GETrequests returningtext/html(the rendered page, not the API)
This typically drops 60-80% of captured traffic. The --include flag can rescue a false positive.
GraphQL / multiplexed endpoint decomposition
When a single endpoint (like /dapi/fe/gql) is called with different operationName values, the skill automatically splits it into separate logical operations. Each gets its own:
OpenAPI path entry (e.g.
/dapi/fe/gql [Autocomplete])Request/response schema inferred from only that operation's samples
Curl example and variables table in the report
Detection works on body fields (operationName, method, action) and query params (opname, op). This covers GraphQL (APQ and inline), JSON-RPC, and similar dispatch patterns.
Limitations
Coverage is bounded by the captured flow. Endpoints not exercised in the trace will not appear. The skill cannot prove completeness.
Schemas are inductive, not contractual. A field might be optional on the server even if every sample contained it.
Auth is observed, not specified. The skill records auth-shaped headers in an
x-observed-authextension but won't claim a security scheme.Path templating is heuristic. Numeric / UUID / hex / slug patterns are detected per segment. Ambiguous URLs are flagged in
confidence.json.Redaction is best-effort. Default redactions cover common credentials, but app-specific secrets may slip through; use
--redactfor known custom headers/keys.
Best practices
Drive the flows you want documented. The richer the browser-trace, the richer the spec.
Use
--originsfor noisy sites. A marketing page hits dozens of analytics hosts; restrict to the API origin you care about.Inspect
report.mdfirst. It has curl-ready examples and response samples for every discovered operation.Bump
--min-samplesto 2+ when you want only confidently-shaped endpoints in the final doc — drop the long tail.Pair with
browse network onwhen response-body schemas matter. The CDP firehose alone has request bodies but not response bodies.
For pipeline internals and the file format reference, see REFERENCE.md.
Files
- ATTRIBUTION.mdAdded by AutoGineer878 B
- LICENSE.txt1.0 KiB
- REFERENCE.md13.7 KiB
- SKILL.md9.5 KiB
- package.json92 B
- scripts/discover.mjsScript3.7 KiB
- scripts/emit.mjsScript32.0 KiB
- scripts/filter.mjsScript2.8 KiB
- scripts/infer.mjsScript5.3 KiB
- scripts/lib/io.mjsScript1.7 KiB
- scripts/lib/path-template.mjsScript3.4 KiB
- scripts/lib/redact.mjsScript2.3 KiB
- scripts/lib/schema-merge.mjsScript6.2 KiB
- scripts/lib/yaml.mjsScript3.1 KiB
- scripts/load.mjsScript6.3 KiB
- scripts/normalize.mjsScript10.8 KiB
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Declares allowed tools, Needs Node.js
The author says: Requires Node 18+ and a `browser-trace` run directory (`.o11y/<run>/`) produced by the sibling `browser-trace` skill. The scripts use only the Node standard library — no `npm install` step. `jq` is referenced in docs for ad-hoc querying but is not required by the scripts.
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Browserbase
- Publisher
- Browserbase (Official)
- Source
- browserbase/skills · skills/browser-to-api · commit 6811ca3
- Licence
- MIT License (redistribution allowed)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Browserbase.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download browser-to-api.zip