Knowledge Base

HAR-to-Client: Agents Reverse-Engineer Site APIs from Browser Traffic

HAR-to-Client: Agents Reverse-Engineer Site APIs from Browser Traffic

Source: https://x.com/i/status/2078727284865827140

📌 AI agents can record browser network traffic as HAR files and generate direct HTTP clients for a site’s real XHR/fetch APIs. That replaces repeated full-browser automation with faster, cheaper, more stable scripts—while still carrying secrets, ToS, and endpoint-drift risks.

📡 The pattern

Browse once (or let an agent browse), capture requests as a HAR file, then have the agent analyze traffic and emit a CLI, SDK, or script that hits the same endpoints directly.

⚡ Why it beats browser-only control

Direct clients skip replaying full browser sessions each run—lower latency, fewer tokens, and more stable automation for repeated flows against undocumented web APIs.

📦 What HAR is

HAR is a JSON log of HTTP requests, responses, headers, and timings exported from Chrome, Firefox, Playwright, and similar tools—long used for hand reverse-engineering of private APIs.

👤 Who popularized it

Attributed to James Long (@jlongster); widely shared in July 2026 by OpenCode builder dax (@thdxr) with an Uber Eats CLI demo, plus banking tools and agent “skills.”

⚠️ Risks and limits

HARs often hold cookies and tokens; private endpoints drift; generated clients may violate ToS; auth and anti-bot flows can still require occasional browser use to refresh sessions.

Key facts

Fact Value
Technique Record browser traffic as HAR → AI derives HTTP client for real site APIs
Popularizers James Long (@jlongster); demo by dax (@thdxr), Uber Eats CLI
HAR format JSON archive of requests/responses/headers/timings; .har extension
Related tools Integuru, reverse-api-engineer, TraceMiner, printingpress.dev skills
Main risks Secrets in HARs, ToS/private APIs, endpoint drift, residual auth/browser need
Benefit vs browser control Faster, lower-latency, less token-heavy for repeated automation

Details

Coding agents can already drive a browser to click through a site. A more efficient pattern is to record the underlying network traffic while those actions run, save it as a HAR (HTTP Archive) file, and let the agent analyze that traffic to build a direct HTTP client—CLI tool, SDK, or script—for the same flows. Once the client exists, automation talks to the site’s real XHR/fetch endpoints instead of replaying a full browser session every time.

HAR is a long-standing web-debugging format: a JSON log of HTTP requests and responses exported from Chrome, Firefox, Playwright, and similar tools. Developers have used it for years to reverse-engineer private or undocumented web APIs by hand. What is new is treating the HAR as agent fuel—browse once, hand over the capture, and generate a typed client. In July 2026, dax highlighted a trick attributed to James Long: record network requests into a HAR, derive a client for any site, and skip continuous browser control.

It matters because many products have no public API, or only a clunky one, while their web UI already speaks a clean internal API. The same pattern shows up in tools such as Integuru, reverse-api-engineer, and TraceMiner. Caveats remain: HAR files often contain cookies, tokens, and personal data; private endpoints can change without notice; generated clients may violate a site’s terms of service; and auth or anti-bot flows can still force occasional browser use to refresh sessions.

Sources