Create realistic API responses for testing.
Create realistic API responses for testing.
Route example: /api/users or /api/users/123
Header example: Content-Type: application/json
JSON example: {"id":1,"name":"Example"}
No output generated yet.
Validate & Format
API & Request Utilities
API mocking simulates backend responses so frontend teams can build and test without waiting for production APIs.
Mocks unblock UI work, speed up QA, and make error-state testing deterministic and repeatable.
Use 2xx for success, 3xx for redirect flows, 4xx for client errors, and 5xx for server failures.
Use preset templates for success, pagination, empty states, auth failures, validation errors, and server errors.
Generate express route snippets to create quick local mock endpoints for development environments.
Use the fetch output to simulate client calls and shape payload expectations in frontend code.
Combine mocked status, latency, and payload presets to test loading, error, and success states comprehensively.
Everything runs in your browser and remains local. No uploads, no signup, and no tracking.
Safe for internal API payloads. Runs fully in your browser with no uploads, no signup, no tracking.
Advertisement
An API mock is a fake response that mimics a real API endpoint. Use mocks when the backend isn't ready yet, when you want to test error handling (404, 500, 429 rate limit), or when writing frontend tests that shouldn't hit a real server. This tool generates the full response object — status code, headers, and JSON body — ready to paste into your mock server or test fixture.
Set the status code to 401 and add a WWW-Authenticate header. The response body typically includes an error code and message: {"error": "unauthorized", "message": "Bearer token required"}. Use this to test that your frontend correctly redirects to login when the API returns 401.
Yes. The generated JSON response object maps directly to msw (Mock Service Worker) handler syntax and json-server route definitions. Copy the body as your handler's return value and set the status code in the response options. For msw: res(ctx.status(200), ctx.json(mockBody)).
Add a meta or pagination object to the response body with fields like page, per_page, total, and total_pages. Include a next link in headers or the body if your API uses Link headers (GitHub-style) or next/prev fields (JSON:API style). This tool lets you customize the body structure to match your API's exact pagination contract.
Advertisement