How to use the Mock API Response Generator
- Set the method, path and status code — common error bodies are filled in for you.
- Edit the JSON body, headers and delay.
- Copy the MSW handler, Express route or test mock.
What does this tool do?
Mocking lets you build and test UI before the backend exists, and simulate errors and slow networks that are hard to reproduce. The tool outputs Mock Service Worker handlers (for browsers and Node tests), an Express route for a quick fake server, or a one-line fetch mock for Jest and Vitest.
Everything runs in your browser — nothing you paste is uploaded.
Why use it?
- Four output styles.
- Error presets.
- Simulated delay.
Use cases
- Build front ends before the API is ready.
- Test error and loading states.
- Write reliable unit and integration tests.
Simulating a slow error
GET /api/orders with status 503, a JSON error body and a 2,000 ms delay. Use it to check that your loading spinner, retry button and error message all work before the real backend exists.
Common mistakes
- Only mocking success responses.
- Mock data that doesn't match the real API's shape.
- Leaving mocks switched on in production builds.
Privacy
Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.
Frequently asked questions
What is MSW?
Mock Service Worker intercepts requests in the browser or Node, so your app code doesn't change.
Express or MSW?
MSW for tests and front-end development; Express when you want a quick fake server others can call.
Can I add headers?
Yes, set the headers, status and delay.
Content last updated . See how M2Toolkit works.