How do I generate a mock API response online?
Set method, route, status, headers, JSON, and delay, then copy JSON, MSW, or Express. Free, no signup. No hosted URL is created.
Builds mock responses and snippets in your browser. It does not publish a public URL your app can call.
Skip to API mock generatorDesign a mock API response in your browser—method, route, status, headers, JSON, and delay—then copy JSON, an MSW handler, or an Express route. Fetch and cURL are request examples only. Nothing is uploaded, and no public API URL is created.
An API mock generator helps you design a fake HTTP response—status, headers, and JSON—so frontend and test code can run before a backend exists. This page builds that response in your browser and exports JSON, MSW, and Express snippets. It does not host a public URL.
An API mock generator is a shortcut for inventing the HTTP contract your UI already needs: method, route, status code, headers, JSON body, and optional delay. You use it when the real API is missing, flaky, or too slow to exercise error states.
This EverydayTools page is a mock API response generator. You author the response locally, preview it as HTTP, then copy a JSON config, an MSW handler, or an Express route. Fetch and cURL outputs are client request examples—they call an API; they do not create one.
It does not publish a live mock URL. If another device, CI job, or teammate must `fetch()` a public HTTPS endpoint, use a hosted mock server instead.
Use this generator to design and export mock responses. Use MSW, Express, or a hosted mock server when something must actually answer HTTP requests.
Concise answers for common searches — definitions, steps, and comparisons.
Set method, route, status, headers, JSON, and delay, then copy JSON, MSW, or Express. Free, no signup. No hosted URL is created.
No. It designs the response and development snippets locally. Hosted mock APIs give you a public URL; this tool does not.
Yes for core use: payloads stay in your browser. Saved mocks remain in localStorage on your device.
Pick GET, POST, PUT, PATCH, or DELETE and enter a path such as /api/users or /api/users/1.
Use 200 or 201 for success, 204 for an empty body, and 4xx/5xx for errors. Set delay in milliseconds to simulate latency for loading states.
Keep Content-Type: application/json for typical REST mocks. Paste the response body, then format or fix JSON until validation passes. Leave the body empty for 204.
Check the local HTTP preview, then copy JSON config, an MSW handler, or an Express route. Fetch and cURL tabs are request examples only—not hosted endpoints.
These phrases overlap in search. Match the product type to the job—this page is a local response designer.
| Need | This page | MSW / Express / fixtures | Hosted mock server |
|---|---|---|---|
| Design JSON + status + headers | Yes | You paste what you designed | Yes |
| Frontend work with no backend | Via MSW export | MSW intercepts in-app | Via public URL |
| Public HTTPS URL | No | No (unless you deploy Express) | Yes |
| OpenAPI → full mock API | No | Separate codegen tools | Often yes |
| Signup required | No | No | Often yes |
If you searched for a mock API URL, a fake REST endpoint, or an OpenAPI mock server, you want the right-hand column—not this generator.
Capabilities that are implemented on this page.
| Feature | Supported | Notes |
|---|---|---|
| HTTP methods | Yes | GET, POST, PUT, PATCH, DELETE |
| Status codes | Yes | 100–599 plus presets for 2xx/4xx/5xx |
| Headers | Yes | One Header: value per line |
| JSON body | Yes | Validated and formattable |
| Response delay | Yes | Milliseconds, included in MSW and Express |
| MSW / Express export | Yes | Copy-ready handlers and routes |
| Hosted endpoint URL | No | Use a mock server instead |
| OpenAPI / Faker import | No | Out of scope for this tool |
Input
GET /api/users/1 · status 200 · delay 120msOutput
{ "id": 1, "name": "Ada Lovelace", "email": "ada@example.com" }Default success mock for a profile or detail view.
Input
POST /api/users · status 201 · Location: /api/users/42Output
{ "id": 42, "name": "Ada Lovelace", "email": "ada@example.com" }Useful for forms that expect a new id and a Location header.
Input
GET /api/users · status 200Output
{ "data": [...], "pagination": { "page": 1, "limit": 10, "total": 42, "pages": 5 } }A common REST list envelope for infinite scroll and page controls.
Input
GET /api/users/999 · status 404Output
{ "error": "Not found", "message": "No user exists with that id." }Tests missing-resource UI without a real empty database row.
Input
Same 200 mock → MSW handler tabOutput
http.get('*/api/users/1', async () => { await delay(120); return HttpResponse.json(...) })Copy into Mock Service Worker. This intercepts requests in the browser or test runner—it is not a public URL.
If production uses data[] plus pagination, mock that envelope—not a bare array. Contract drift is how UI bugs survive until integration.
201 for creates, 204 for empty deletes, 400/422 for bad input, 401/403 for auth, 404 for missing rows, 409 for conflicts, 429 for rate limits, 500 for server failures.
Frontends branch on error.code or error.fields. A string-only 500 is weaker than the shape your API will actually return.
A 200–1000ms delay is enough to test skeletons, disabled submit buttons, and retry logic. Zero-delay mocks hide loading-state bugs.
Do not paste live access tokens, production PII, or private keys into mock bodies you save or commit.
Frontend
Copy the MSW tab into handlers.ts. The handler uses http.get/post plus HttpResponse.json, including status, headers, and delay, so your UI can render against the contract you designed.
Local Node
Paste the Express snippet into a small local app when you want a process that answers the route on localhost. This is still your server—not an EverydayTools URL.
QA
Switch presets for 401, 404, 429, or 500 and keep the same route. Replay loading, retry, and empty-state UI without waiting on staging.
API design
Download the JSON config so a teammate can see method, route, status, headers, and body in one file. Pair with JSON Formatter if the body needs cleaning first.
This page never hosts endpoints. Export MSW or Express, or move the same JSON into a hosted mock server.
Fetch and cURL are client request examples. They need a real or mocked server. Use the MSW or Express tab to mock the response.
Add 401/404/422/500 presets so error UI is not an afterthought.
Use a hosted mock API. This generator only designs responses and snippets on your machine.
Import the spec into a mock server product, or run json-server locally. Those are different tools.
Use JSON Formatter—faster when you do not need status codes or exports.
This page does not include a Faker schema builder. Author the JSON you want, or generate sample data elsewhere and paste it here.
Format and validate JSON on those pages. Come back here when the payload needs an HTTP envelope and export snippets.
| Related tool | Use this tool when | Use related tool when |
|---|---|---|
| JSON Formatter | You need the full mock (status, headers, delay) or MSW/Express snippets. | You only need to beautify or minify a JSON body before pasting it here. |
| JSON Validator | The JSON is already valid and you are wrapping it in an HTTP mock. | The body fails to parse and you need line/column syntax errors first. |
Continue the workflow with the right follow-up tool.
Advertisement
A tool that helps you invent fake API behavior for development and testing. This one designs status, headers, and JSON in your browser and exports snippets. Some other products host a URL your app can call; this page does not.
Choose a method and route, set the status code, add headers, paste JSON, and optionally set a delay. Preview the local HTTP response, then copy JSON, MSW, or Express output into your project.
Yes. The usual workflow is: design the JSON here, copy the MSW handler, and intercept fetch/XHR in development or tests. You can also paste the body into Storybook fixtures. The Fetch tab only shows how a client would call the route.
Yes. Use the presets or type any status from 100–599. 401, 403, 404, 409, 422, 429, and 500 are included so you can test auth, missing resources, validation, rate limits, and server failures.
Set Delay in milliseconds. MSW uses delay(); Express uses setTimeout. That lets you test skeletons, spinners, retries, and timeouts without a slow network.
People often say “mock API” and “fake API” for any simulated response. A mock server is software that actually answers HTTP. This page is a response designer plus snippets. MSW intercepts in the client; Express is a local server you run; a hosted mock API is a public URL.
Yes. Copy the Express route tab into an Express app. It sets headers, status, JSON, and delay. You still run that app yourself on localhost.
Yes. The MSW handler tab emits Mock Service Worker v2 syntax (http.* and HttpResponse). Paste it into your handlers file. This page does not start the worker for you.
No. EverydayTools never publishes a mock endpoint. There is no shareable https URL for your JSON. Use a hosted mock server if you need something another machine can call.
No. Validation and snippet generation run in the browser. Optional saves use localStorage on your device, not EverydayTools servers.
No. The generator is free and works without signup.
Mock definitions stay in your browser. Optional saves use localStorage on your device—not EverydayTools servers.
Status clamping, header parsing, and JSON validation run client-side. Snippets are templates—review them before committing.
All mock building and export rendering runs in the browser after page load. No account is required.
Not a hosted mock API, API gateway, or OpenAPI mock server. You remain responsible for how exported mocks are used.
Advertisement
Reviewed by EverydayTools Editorial Team on 2026-09-15.
Same workflow or intent — pick the next step without leaving the site.
Free .env file parser — paste any .env file and extract all environment variables as structured JSON or YAML. Useful for config migration and debugging. No signup needed. Runs locally in your browser when supported—no upload required for normal use.
Generate a secure random API key or webhook secret in your browser. Hex, Base64url, or alphanumeric. Keys stay local—not a Stripe or OpenAI credential.
Free number base converter: binary, decimal, octal, hex, and custom bases 2–36. Live convert with BigInt for large integers. Browser-local, no signup.
Encode text to Base64 or decode a Base64 string online. UTF-8 safe, with URL-safe Base64. Runs in your browser—no upload, no signup.
See your browser name and version in one second—plus OS, screen size, and user agent. Copy for support; runs locally with nothing uploaded.
Minify or beautify HTML, CSS, and JavaScript in your browser with UTF-8 size comparisons, copy, and download. No source upload.
Frequently opened tools from the same category.
Free JSON formatter — paste minified or messy JSON and instantly get beautified, indented output with syntax highlighting and error detection. Browser-based, no server upload. Runs locally in your browser when supported—no upload required for normal use.
Free JSON diff & compare — structural side-by-side diff, ignore paths, array modes, RFC 6902 patch and merge patch export. Runs locally in your browser—no upload.
Free UUID generator: v4, v7 & v1 GUIDs in your browser—bulk up to 1,000, validate, export JSON/CSV. crypto.randomUUID; never uploaded.
Free random number generator — Web Crypto integers or decimals, no-repeat draws, dice, coin flip, and list picker. Copy or CSV. Runs locally in your browser.
Cross-category tools others open in the same session.
What is 20% of 500? Percent increase, decrease, difference, reverse %, markup & margin—runs locally in your browser, no upload. Copy results or share a link.
Free JSON formatter — paste minified or messy JSON and instantly get beautified, indented output with syntax highlighting and error detection. Browser-based, no server upload. Runs locally in your browser when supported—no upload required for normal use.
Free word counter — live word, sentence, and paragraph counts plus reading time for essays, blogs, and SEO drafts. Runs locally in your browser.
Free adult BMI from height and weight (lb/ft/in or kg/cm). CDC category, healthy weight range, optional waist. Screening only—runs in your browser.
Browse full tool collections by topic.
Mock API response generator