Creating Mock APIs from HAR Files

Turn recorded API traffic into working mock servers. Import HAR files and generate mock APIs in under 60 seconds - no code required.

Building frontend applications often means waiting for backend APIs that don't exist yet. Or testing against third-party APIs with rate limits. Or debugging issues that only happen in production.

What if you could record real API traffic and instantly spin up a mock server that behaves exactly the same way? That's what ProxyKit's HAR-to-Mock feature does.

Why Mock APIs from HAR Files?

HAR (HTTP Archive) files capture real API traffic, including:

This makes HAR files the perfect source for mock servers because the responses are real data from real APIs. No guessing, no manual mocking, no keeping mock data in sync with production.

Use Cases

HAR-based mock servers solve real problems:

How It Works

ProxyKit's mock server generator works in three steps:

  1. Capture a HAR file

    Use browser DevTools, Charles Proxy, or any HTTP capture tool to record API traffic as a HAR file.

  2. Upload to ProxyKit

    Visit the HAR Viewer and upload your HAR file. ProxyKit parses all requests and responses.

  3. Generate your mock server

    Click "Generate Mock Server" and get a unique URL. Every endpoint from your HAR file is now available as a working API.

Step-by-Step: Creating Your First Mock Server

1. Capture the HAR File

Open Chrome DevTools (F12 or Cmd+Option+I), go to the Network tab, and perform the API operations you want to mock. Then:

  1. Right-click anywhere in the request list
  2. Select "Save all as HAR with content"
  3. Save the file
Pro Tip

Filter your network requests to show only XHR/Fetch before saving. This excludes images, fonts, and other static assets you don't need to mock.

2. Upload and Review

Go to ProxyKit's HAR Viewer and drag your HAR file onto the page. You'll see all captured endpoints organized by domain.

Review the endpoints to make sure they include the APIs you want to mock. Use the filters to narrow down by HTTP method or status code.

3. Generate the Mock Server

Click the "Generate Mock Server" button. ProxyKit will:

4. Use Your Mock Server

Replace your API base URL with the mock server URL. For example, if your real API was:

https://api.example.com/v1/users

And your mock server is:

https://proxykit-7xjg.polsia.app/mock/a1b2c3d4

Then call:

https://proxykit-7xjg.polsia.app/mock/a1b2c3d4/v1/users

The mock server responds with the exact same data from your HAR file.

What Gets Mocked

Each mock endpoint preserves:

Attribute Preserved?
HTTP Method (GET, POST, etc.) Yes
URL Path Yes
Response Status Code Yes
Response Headers Yes (most)
Response Body Yes
Query Parameters Stored, not matched
Note on Query Parameters

Mock routes match by HTTP method and path only. Query parameters in the HAR are stored but requests with different query params will still match the same route.

Mock Server Features

CORS Enabled

All mock endpoints include CORS headers, so you can call them from any origin. No proxy configuration needed.

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: *

Automatic Deduplication

If your HAR file contains multiple requests to the same endpoint (same method + path), ProxyKit uses the first one. This keeps your mock server clean.

7-Day Expiration

Mock servers expire after 7 days to keep things clean. Need a longer-lived mock? Export to OpenAPI and use a dedicated mock service.

Viewing Available Routes

After generating a mock server, you can view all available routes by visiting:

https://proxykit-7xjg.polsia.app/mock/{your-slug}

This returns a JSON object listing every route, its HTTP method, and status code.

When to Use Mock Servers vs OpenAPI

ProxyKit can export to both mock servers and OpenAPI specs. Here's when to use each:

Use Case Mock Server OpenAPI
Quick frontend testing Best -
Demos and presentations Best -
API documentation - Best
Code generation - Best
CI/CD integration Good Best

Limitations

HAR-based mock servers work great for static responses. They don't support:

For dynamic mocking with request validation and stateful behavior, export to OpenAPI and use a tool like Prism or Mockoon.

Conclusion

HAR-to-Mock is the fastest way to create realistic mock APIs. No code, no configuration, just real responses from real traffic.

Next time you're waiting for a backend API, blocked by rate limits, or debugging a production issue, capture a HAR file and spin up a mock server in seconds.

Ready to Create Your Mock Server?

Upload a HAR file and generate a working mock API in under 60 seconds.

Open HAR Viewer