API Response Mocker
Generate mock JSON API responses from schema definitions. Create realistic test data with nested objects, arrays, and pagination.
About This Tool
The API Response Mocker is a free, browser-based tool that lets you design a JSON schema and instantly generate realistic mock API responses. Whether you are building a frontend prototype, writing integration tests, or documenting an API, having realistic sample data speeds up every stage of development.
Start by defining fields with names and types — choose from string, number, boolean, date, email, UUID, URL, enum, nested object, or array. Each field supports a configurable nullable probability, and array fields let you set minimum and maximum lengths. For complex payloads you can nest objects inside objects to any depth.
Once your schema is ready, pick a response wrapper. Bare returns
a single object or a plain JSON array. Data array wraps items in
{ "data": [...] }. Paginated adds a meta block with
total, page, perPage, and totalPages fields, which
mirrors common REST pagination patterns. Adjust the item count
slider from 1 to 100 to control how many records appear.
The HTTP status selector lets you generate error responses too.
Selecting 400, 404, or 500 produces a structured error body with
code, message, and details fields that follow widespread
API conventions. This is useful for testing how your UI handles
different failure modes.
Built-in presets for User API, Product API, and Blog Posts API give you a head start. Load a preset, tweak the fields, and generate data in seconds. The output panel displays syntax-highlighted JSON that you can copy or download.
All processing happens entirely in your browser. No data is sent to
any server — the random values are generated client-side using
JavaScript's Math.random(), so there are no network requests
or third-party services involved.
If you need to validate the generated JSON against a schema, try the JSON Schema Generator. To format or inspect the output further, open it in the JSON Formatter. For generating large volumes of realistic test records, check out the Mock Data Generator.
How to Use
- Define your response schema by adding fields. Enter a field name and choose a type (string, number, boolean, date, email, uuid, url, enum, object, or array).
- For enum fields, enter comma-separated values in the text box that appears.
- For object or array fields, click the expand arrow and use Add sub-field to create nested structures.
- Set the nullable probability (0–100%) for any field to control how often it returns
null. - Adjust the Item Count slider (1–100) and choose a Wrapper format: bare, data array, or paginated.
- Select an HTTP Status code. Choosing 400, 404, or 500 generates a structured error response instead.
- Click Generate Response or load a preset (User API, Product API, Blog Posts API). Copy the output with the Copy button or press Ctrl+Shift+C. Use Download to save as a
.jsonfile.
Popular API Response Mocker Examples
FAQ
Is my data safe?
Yes. All mock data generation runs entirely in your browser using JavaScript. No data is sent to any server. You can verify this by checking the Network tab in your browser's developer tools while using the tool.
How realistic is the generated data?
The tool generates plausible-looking values for each type: human-like names and emails, valid UUID v4 strings, ISO 8601 dates, realistic URLs, and proper boolean values. While not production-grade faker data, it is well suited for prototyping, testing, and documentation.
Can I create deeply nested objects?
Yes. You can nest object and array fields to any depth. Click the expand arrow next to an object or array field, then use 'Add sub-field' to define the child structure. Each child can itself be an object or array.
What pagination formats are supported?
The tool supports three wrapper formats: bare (raw object or array), data array ({ data: [...] }), and paginated ({ data: [...], meta: { total, page, perPage, totalPages } }). The paginated format follows the common REST API pattern used by many frameworks.
Can I generate error responses?
Yes. Select an HTTP status code of 400, 404, or 500 from the status dropdown. The tool generates a structured error response with code, message, and details fields that follow common API error conventions.
How do I control array lengths?
For array-type fields, two number inputs appear that let you set the minimum and maximum number of items. Each generation run picks a random length within that range.
What are the presets?
Three built-in presets (User API, Product API, Blog Posts API) pre-fill the schema with commonly needed fields. Load a preset and customize it to save time. Presets include nested objects, arrays, enums, and nullable fields to demonstrate the tool's full capabilities.
Related Tools
JSON Schema Generator
Generate JSON Schema from sample JSON data with type inference, required fields, and nested object support.
JSON Formatter
Format, validate, and beautify JSON with syntax highlighting and tree view.
Mock Data Generator
Generate fake names, emails, addresses, and more. Export as JSON, CSV, SQL, or TypeScript.
HTTP Method Reference
Interactive HTTP method reference with detailed specs for GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, and more.
HTTP Status Codes
Browse, search, and learn about all HTTP status codes with detailed explanations.
Health Check Endpoint Designer
Design health check endpoint JSON responses with component checks, HTTP status mapping, and Kubernetes probe formats.