Loading...
Loading...
Turn a website's observable HTTP traffic into a best-effort OpenAPI 3.1 spec by analyzing a `browser-trace` capture. Use when the user wants to discover/extract API endpoints from a browser session, build an OpenAPI doc from network traffic, or document a third-party site's XHR/fetch surface for client integration.
npx skill4agent add browserbase/skills browser-to-apibrowser-tracebrowser-tracecdp/network/*.jsonlbrowser-trace → .o11y/<run>/cdp/network/{requests,responses}.jsonl
browser-to-api → .o11y/<run>/api-spec/index.html + openapi.yaml + client.mjsbrowser-tracebrowser-tracebrowser-tracebrowse network on# Local example (see browser-trace SKILL.md for Browserbase variant)
browse env local
browse open about:blank
TARGET="$(browse status --json | jq -r .wsUrl)"
node ../browser-trace/scripts/start-capture.mjs "$TARGET" my-site
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 onbrowse cdprequestIdnode 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<run>/cdp/network/bodies/browse network--bodies <path>discover.mjsopen .o11y/my-site/api-spec/index.htmlclient.mjs| Flag | Required | Meaning |
|---|---|---|
| yes | Path to a |
| no | Output dir; default |
| no | |
| no | Only include URLs matching regex (repeatable) |
| no | Exclude URLs matching regex (repeatable; in addition to defaults) |
| no | Comma-separated origin allow-list (e.g. |
| no | Output format. Default |
| no | OpenAPI |
| no | Extra header names / JSON keys to redact (comma-separated) |
| no | Minimum samples per endpoint to include. Default |
| no | Run only one stage: |
<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)browse cdpbrowse network| Source | Provides | Limitation |
|---|---|---|
| request method/URL/headers/ | Does not embed response bodies. Bodies must be pulled with |
| request bodies AND response bodies on disk, keyed by CDP | Capture dir is shared per |
discover.mjsbrowse network--bodies <path><run>/cdp/network/bodies/requestIdbrowse networkrequest.jsonidpostDatapostData{ description, content: <mimeType> }/track/pixel/beacon/impression/pageview/dag/v*/akam/sensor_data/session/authenticate/startGETtext/html--include/dapi/fe/gqloperationName/dapi/fe/gql [Autocomplete]operationNamemethodactionopnameopx-observed-authconfidence.json--redact--originsreport.md--min-samplesbrowse network on