[
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "Alice Smith",
"email": "[email protected]",
"role": "admin",
"active": true,
"created_at": "2024-01-01T00:00:00.000Z"
}
]You Might Also Like
API Mock Generator — Build Fake REST APIs with Realistic JSON for Frontend Development
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
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.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.