harspec GitHub

Open source · MIT · Python 3.9+

Undocumented API?
Get the docs in 30 seconds.

harspec reads a HAR file (the network recording from your browser) and writes an OpenAPI spec, TypeScript and Python clients, curl examples, a Postman collection and an auth summary. No dependencies. Nothing leaves your machine.

pip install harspec
harspec capture.har

What you get

OpenAPI spec

Paths, parameters, request and response schemas for every status code, examples and security schemes.

Typed clients

A TypeScript fetch client and a Python requests client with a method per endpoint.

Ready to test

Runnable curl commands and a Postman collection, grouped by resource.

Auth explained

Bearer, Basic, API key and cookie auth, plus the login endpoint and CSRF headers.

Safe by default

Tokens, cookies, passwords and JWTs are redacted while the file is read.

Extensible

Add a generator for any language in about 15 lines. Plugins install with pip.

How it works in 3 steps

  1. Record. Open the site, press F12, use the app, then save the Network tab as a HAR file.
  2. Run. harspec capture.har
  3. Use. Open harspec-out/: import the spec, copy a client, run the curl examples.
Important: A HAR file contains your live session (tokens and cookies). Record on a test account, never share the .har itself, and only analyse services you are allowed to use.