# Reverse API Engineer

> A CLI that browses a website (you or an AI agent at the wheel), captures the network traffic and has a model write a typed API client for the endpoints the site really uses

- Category: Data & Labeling / Web Scraping & Crawling
- Language: Python
- Licence: MIT
- Repository: https://github.com/kalil0321/reverse-api-engineer
- Website: https://reverseapi.dev
- Canonical page: https://ai-tldr.dev/tools/reverse-api-engineer/

## In short

Reverse API Engineer is an open-source command-line tool whose stated job is to turn websites into APIs. It sits in the Web Scraping & Crawling category of the Data & Labeling tools and is open-source, written in Python and licensed MIT. To get started: install.

## Overview

Reverse API Engineer is an open-source command-line tool whose stated job is to turn websites into APIs. You give it a website and a goal, such as "fetch all Apple jobs"; a browser visits the site, driven either by you or by an AI agent; the network traffic is captured to a HAR file; and your configured model reads that traffic and writes a working API client. It replaces the manual routine of opening DevTools, copying cURL commands and gluing a client together by hand.

The CLI has four modes, cycled with Shift+Tab. In `manual` mode you drive the browser and the AI generates the client from what was captured. In `agent` mode (the default) an AI agent does the capture itself, through Playwright MCP, Chrome DevTools MCP against your real Chrome (so existing sessions and cookies carry over), or Vercel's `agent-browser` CLI. `engineer` re-runs generation on a previous capture, and `collector` has an agent gather structured JSON or CSV data using web search and fetch.

Generation runs through a choice of agent SDKs — Claude (the default), OpenCode (including local Ollama models), Cursor or GitHub Copilot — and the client can be written in Python, JavaScript, TypeScript, Go, Java, C#, PHP, Ruby, C or PowerShell. Each run is stored under `~/.reverse-api/runs/` and copied to `./scripts/<name>/` with an `api_client.py`, a README and an example. The project is written in Python, MIT-licensed and published on PyPI; its README cautions that generated code runs locally and should be reviewed, and that sites with aggressive bot detection may block capture.

## What it does

- Captures a browsing session's network traffic to a HAR file and has a model write a typed API client from it
- Four modes on Shift+Tab: manual browsing, autonomous agent capture, re-generation from an earlier capture, and a data collector that outputs JSON/CSV
- Agent capture via Playwright MCP, Chrome DevTools MCP on your own logged-in Chrome, or the Vercel agent-browser CLI
- Pluggable SDKs — Claude, OpenCode (with Ollama support), Cursor or GitHub Copilot — set from `/settings`
- Clients in ten languages: Python, JavaScript, TypeScript, Go, Java, C#, PHP, Ruby, C and PowerShell
- Scriptable subcommands (`agent`, `list`, `show`, `run`) with a versioned `--json` output schema and documented exit codes

## Getting started

Reverse API Engineer needs Python 3.11+ and installs as a uv tool or with pip. Agent mode needs no extra Python packages; manual mode needs the `[manual]` extra and a Playwright Chromium.

1. Install

   Install the CLI. Add the `[manual]` extra and Chromium only if you want to drive the browser yourself.

```bash
uv tool install reverse-api-engineer   # or: pip install reverse-api-engineer

# optional, for manual mode
uv tool install "reverse-api-engineer[manual]"
playwright install chromium
```

2. Describe the API you want

   Start the interactive CLI and type a goal. A browser opens; navigate and interact (or let the agent do it), then close it. The generated client lands in a local folder.

```bash
reverse-api-engineer
> fetch all apple jobs from their careers page

# Browser opens. Navigate, interact, close when done.
# → ./scripts/apple_jobs_api/  (api_client.py, README.md, example_usage.py)
```

3. Pick a mode, model and output language

   Shift+Tab cycles manual / agent / engineer / collector. `/settings` sets the SDK, model, agent provider and output language; they are stored in `~/.reverse-api/config.json`. `/history` lists past runs with costs and status.

4. Script it

   Every step is also a non-interactive subcommand. With `--json`, stdout is a single JSON document (run id, HAR path, generated script path, token usage) and logs go to stderr.

```bash
reverse-api-engineer agent --prompt "capture the public jobs api" \
  --url https://example.com/jobs --json | jq

reverse-api-engineer list --json
reverse-api-engineer show <run_id> --json
reverse-api-engineer run <run_id> --file api_client.py \
  --no-interactive --auto-install -- --org acme
```

## When to use it

- Get a reusable client for a site's internal JSON endpoints instead of scraping and parsing its rendered HTML
- Reverse-engineer an API behind a logged-in session by letting the agent drive your own Chrome with its cookies
- Collect structured JSON or CSV data from the web for a one-off dataset with the collector mode
- Wire API discovery into a pipeline or another agent through the `--json` subcommands
