{}API Mock Generator
Endpoints
GET/api/users
GET/api/users/:id
POST/api/users
DELETE/api/users/:id
Delayms
Content-Type: application/jsonStatus: 200 OK
Response Body (JSON)
200Simulated response · GET /api/users
[
  {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "Alice Smith",
    "email": "[email protected]",
    "role": "admin",
    "active": true,
    "created_at": "2024-01-01T00:00:00.000Z"
  }
]
🔖
Bookmark this page
Press Ctrl+D to save this tool in your browser for instant access anytime — no sign-up needed.

API Mock Generator — Build Fake REST APIs with Realistic JSON for Frontend Development

Share

About this tool

Free API Mock Generator — Design Fake REST Endpoints with Auto-Generated JSON Data

Frontend development should not wait for the backend. This API mock generator lets you define your REST API contract — endpoints, methods, status codes, and response shapes — and immediately get realistic fake JSON to build against. No backend code, no running server, no sign-up required.

Define as many endpoints as your API needs. For each one, set the HTTP method (GET, POST, PUT, PATCH, DELETE), the path (e.g. /api/users, /api/products/:id), the response status code, and the JSON response body. Click 🎲 Generate fake data and the tool analyzes your field names to fill in realistic values: id fields become UUIDs, email fields become valid-looking email addresses, name fields become person names, created_at fields become ISO timestamps, price fields become decimal numbers, active fields become booleans, and array fields are expanded to 2–5 items with the same schema applied to each.

The simulated response preview shows exactly what the API would return — formatted JSON with a status code pill — giving you a clear picture of the endpoint contract. Copy the cURL command for any endpoint to share with teammates or paste into API testing tools.

Export as JSON Server generates a db.json file ready to run with npx json-server --watch db.json --port 3000 — a real local REST API your frontend can make actual fetch() calls to, with GET, POST, PUT, PATCH, and DELETE all working out of the box.

Export as Postman Collection produces a v2.1 collection with all your endpoints, pre-filled headers, example responses, and a baseUrl variable — import it into Postman in one click.

Everything runs in your browser. Your API definitions are never sent to any server.

Features

  • Multi-endpoint management — sidebar lists all endpoints with method badge, path, and status indicator; add or remove endpoints freely
  • HTTP method selector — GET (green), POST (blue), PUT (amber), PATCH (purple), DELETE (red); color-coded throughout the UI
  • Dynamic path support — use :param segments like /api/users/:id for parameterized routes
  • Full status code coverage — 200, 201, 204, 400, 401, 403, 404, 409, 422, 500 with status text shown
  • Smart fake data generator — analyzes field names to produce UUIDs, emails, names, phone numbers, URLs, ISO dates, prices, ratings, booleans, lorem text, and colors; arrays expanded to 2–5 items recursively
  • JSON validation — real-time invalid JSON warning badge on the body editor so you catch errors immediately
  • Mock delay — set per-endpoint latency (ms) to test loading states and skeleton screens during frontend development
  • Simulated response preview — formatted JSON with status pill and endpoint label; "Copy cURL" for sharing or testing
  • Export JSON Server — generates db.json ready for npx json-server with a one-liner run command shown in the export panel
  • Export Postman Collection — generates v2.1 collection with all endpoints, headers, example responses, and baseUrl variable for direct Postman import

How to Use

The sidebar shows your endpoint list — four example endpoints are pre-loaded. Click any endpoint to select it and edit it in the main panel. To add a new endpoint, click "+ Add" in the sidebar. For the selected endpoint: choose the HTTP method from the dropdown (color-coded by convention), type the API path (use :param for dynamic segments like /api/users/:id), select the status code, and optionally set a delay in milliseconds to simulate network latency. Edit the JSON response body directly in the text editor. Click "🎲 Generate fake data" to auto-populate the body with realistic values based on your field names. The preview panel below shows the simulated response with a status pill. Copy the response JSON with the "Copy" button, or copy a cURL command with "Copy cURL". When your endpoints are complete, click "Export JSON Server" to get a db.json file for running a local API, or "Export Postman" to get a Postman collection for import.

Common Use Cases

Build frontend UI before the backend API is ready
When the backend team is still designing the database schema or building the API, frontend developers can use this tool to define the expected API contract and generate mock JSON. Build your React, Vue, or Angular components against the mock data structure. When the real API is ready, swap the mock URL for the production URL — if you designed the contract correctly, it just works. Use our JSON to TypeScript converter to generate TypeScript interfaces from your mock JSON for type-safe frontend development.
🧪
Generate test data for unit and integration tests
Click "🎲 Generate fake data" multiple times to produce varied test fixtures. Copy the JSON and paste it into your test files as mock API responses for jest.mock(), msw (Mock Service Worker) handlers, or nock intercepts. Each generation produces different random values — names, UUIDs, dates — giving you realistic varied test data without manually writing fixtures. For large datasets, put the schema in an array and the faker produces 2–5 items automatically. Combine with our JSON Formatter to clean up and validate the test fixtures before committing.
🚀
Prototype and demo API-driven features quickly
When presenting a proof-of-concept or demoing a feature to stakeholders, a mock API lets you show real data flowing through the UI without a live backend. Export as JSON Server and run it locally — your demo shows real HTTP requests, real loading states, and real data rendering. Generate realistic-looking names, emails, and prices that look believable in a client demo. The delay setting lets you add realistic latency to show the loading spinner and skeleton states that will appear in production.
🔧
Design and document your API contract before implementation
Use this tool as an API design interface — define all your endpoints, their methods, response shapes, and status codes before writing a single line of backend code. Export as Postman and share with the backend team as the agreed API contract. This reduces back-and-forth between teams and ensures the frontend and backend build to the same spec. The cURL copy button lets you share exact example requests with team members. Use our API Request Generator to test against the real API once it's built.
🐛
Test error handling and edge cases in the frontend
Add error endpoints (401, 403, 404, 500) alongside the happy-path endpoints. Set a 401 endpoint for an authentication failure scenario, a 404 for a resource not found, and a 500 for a server error. Test that your frontend displays the correct error messages, redirects to login on 401, and shows the error boundary on 500. Add a 200 endpoint with an empty array body to test the empty state. Set a 3000ms delay to test the request timeout UI. None of these edge cases require a real backend to test — design them all here.
📦
Create Postman collections for API documentation and team sharing
Export as a Postman Collection to document your API for the team. Import the collection into Postman, set the baseUrl variable to your staging server, and all endpoints are ready to run. New developers joining the project can import the collection and immediately have all API endpoints available without setting up individual requests. The collection includes example responses so developers can see expected output without making a live request. Share the collection JSON in your repository's docs folder for always-up-to-date API documentation.

Frequently Asked Questions

An API mock generator creates fake REST API endpoints with realistic JSON responses without needing a real backend server. Frontend developers use mock APIs during development when the backend is not yet built, when the backend team works on a different sprint, or when testing UI components in isolation. With a mock API, developers can build and test the full frontend data flow — fetching, displaying, and submitting data — using predictable, controlled responses. Mock APIs also help QA teams test edge cases (empty states, error responses, pagination) without depending on backend state.

Click "+ Add" in the sidebar to create a new endpoint. Select the HTTP method (GET, POST, PUT, PATCH, DELETE), type the path (e.g. /api/users or /api/products/:id), and choose the response status code. In the Response Body editor, paste or type the JSON you want the endpoint to return. Click "🎲 Generate fake data" to auto-fill the response with realistic values based on your field names — IDs become UUIDs, email fields get email addresses, name fields get person names, date fields get ISO timestamps, and so on. Add as many endpoints as you need, then export as a JSON Server db.json or a Postman collection.

JSON Server is a zero-configuration REST API server built on Node.js. It reads a db.json file and automatically creates full CRUD endpoints for each top-level key. To use the exported db.json: install JSON Server with npm install -g json-server, save the exported content as db.json, then run npx json-server --watch db.json --port 3000. This instantly creates a real local API at http://localhost:3000 with GET (list + by ID), POST, PUT, PATCH, and DELETE endpoints. Your frontend can make real fetch() or axios calls to it during development. No additional backend code needed.

The fake data generator analyzes your JSON field names and existing values to determine what type of data each field should contain. Field names containing "id" get UUIDs. Fields named "email" get realistic email addresses. Fields containing "name" get person names (first name, last name, or full name). Fields with "phone" or "mobile" get phone numbers. Fields containing "url", "link", "avatar", or "image" get URLs. Date fields (created_at, updated_at, date, timestamp) get ISO 8601 timestamps. Boolean fields (active, enabled, verified, is_* prefixed) get true/false values. Number fields (count, total, price, amount, rating) get appropriate numeric ranges. Array fields are expanded to 2–5 items with the same schema applied to each item. Nested objects are recursively faked.

Yes — click "Export Postman" to generate a Postman Collection v2.1 JSON file. Copy the output and import it into Postman: open Postman, click "Import" (top-left), paste the JSON, and click Import. All your endpoints appear as requests in a new collection with pre-filled headers (Content-Type: application/json) and example responses. Set the baseUrl collection variable to your local server URL (http://localhost:3000 for JSON Server). This lets you test your mock API directly from Postman alongside your real API.

The mock delay simulates real-world network latency. Setting a delay of 500–2000ms helps you test your application's loading states, skeleton screens, and error boundaries in realistic conditions. A delay of 0ms means responses are instantaneous — unrealistic for production but useful for fast unit testing. A delay of 300–800ms simulates a typical API response time on a fast connection. A delay of 2000ms+ tests slow network scenarios and timeout handling. The delay value is included as an X-Mock-Delay header in the simulated response preview so you can document the intended latency alongside the endpoint definition.

Select the endpoint in the sidebar and change the Status Code dropdown to the error code you need: 400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 409 (Conflict), 422 (Unprocessable Entity), or 500 (Internal Server Error). Then edit the Response Body to match the error structure your API uses — for example: {"error": "Not Found", "message": "User with ID 123 does not exist", "code": 404}. Add a separate endpoint for each error scenario. This lets your frontend handle error states without needing the backend to intentionally return errors.

This tool generates mock endpoint definitions and realistic JSON response data — it is a design and planning tool, not a running server. The "simulated response" preview shows what the endpoint would return, but your frontend application cannot make actual HTTP requests to it. To turn the mock definitions into a real running API, export as JSON Server and run it locally with npx json-server, or import into Postman Mock Servers, Mockoon, or WireMock. Use this tool during the design phase to define your API contract and generate test data, then use JSON Server or a similar tool during development.