# Turn HAR Files and "Copy as Fetch" into Clean API Documentation

> Drop a .har file or paste "Copy as fetch", select the calls you want, remove or mask secret keys, and copy a beautified request/response sequence.

URL: https://thuyavan.netlify.app/scripts/har-to-api-docs-formatter
Updated: 2026-10-07

## Problem
API behaviour is scattered across the browser Network tab, and copying URLs, methods and minified JSON bodies one by one is slow and unreadable.

## Solution
A centralised API clipboard that bulk-imports .har files or parses fetch strings, beautifies, filters and sequences the calls into one document.

## Result
A clean, organised API sequence ready for AI prompts, technical docs or bug reports.

## Input
- A .har file (drag-and-drop) or a "Copy as fetch" string plus raw response

## Output
- One structured, beautified text block with stats and a Copy button

## Optional output
- Filtered output with keys removed or wrapped as [...]
- Deduplicated and re-ordered request sequence

## System flow
Capture (.har drop or fetch string) -> Select (Checklist of calls) -> Refine (Beautify · dedupe · key filters) -> Compose (Toggle URL / body / response · reorder) -> Generate (Copy-ready document)

## How it works
- **Dual input:** Manual fetch parsing for one issue, or bulk HAR import for a whole flow.
- **JSON beautifier:** Detects stringified JSON and applies 2-space indentation.
- **Privacy filters:** Recursively remove or wrap keys such as token or password.
- **Deduplication:** Removes identical, repetitive calls.
- **Custom composition:** Show or hide URL, payload and response; Move Up / Move Down ordering.

## Configuration
- `Advanced Filters`: Keys to remove or wrap across all selected requests.
- `Visibility toggles`: Include URL, request payload and/or response body.

## How to run
Option A:

    # Paste a "Copy as fetch" string into Manual Input
Option B:

    # Drop a .har file onto the dashed drop-zone
Finish:

    # Select requests â†’ Remove Duplicates â†’ Generate Output â†’ Copy

## Impact
- Gives AI models the exact network sequence to find logic errors.
- Rapid "Example Request/Response" sections for API docs.
- QA can turn a bug trace into a readable report in seconds.
- The Wrap filter keeps tokens and private data out of shared logs.

## FAQ
**How do I turn a HAR file into readable API docs?**
Drop the .har file onto the tool, tick the requests you need, and click Generate Output.

**Can I hide tokens and passwords before sharing?**
Yes. Advanced filters remove keys or wrap them as [...] across all selected requests.

**Does my data leave my computer?**
No. The tool runs entirely in your browser.

