Developer Tools
API Response Mock Generator
Generate realistic API mock responses instantly. Define schema or examples, get valid JSON, error cases, and ready-to-use curl/fetch/axios code. Perfect for frontend development, testing, and documentation.
{
"id": "00000000-0000-4000-8000-000000000000",
"name": "Taylor Johnson",
"email": "casey.330@example.com",
"age": 18,
"city": "Berlin",
"active": false,
"createdAt": "2024-10-19T19:07:33.518Z"
}curl -X GET "https://api.example.com/users" \ -H "Accept: application/json" \ -H "Content-Type: application/json"
const res = await fetch("https://api.example.com/users", {
method: "GET",
headers: { "Content-Type": "application/json" }
});
const data = await res.json();
console.log(data);const { data } = await axios.get("https://api.example.com/users");
console.log(data);import requests
r = requests.get("https://api.example.com/users")
print(r.json())const res = await fetch("https://api.example.com/users");
const json = await res.json();
console.dir(json);Everything runs locally in your browser. Use the seed for stable test data across runs.
Why Mock APIs Matter
Building the frontend against a real backend is slow and brittle during early development. A good mock generator lets you iterate fast, test error states, and validate UI against realistic data shapes without waiting for the backend team or spinning up services. It also helps document expected contracts early and enables parallel work between frontend and backend teams.
Scenarios Covered
- Simple resource objects (users, products, orders)
- Nested structures and arrays of objects
- Paginated responses with metadata
- Client and server error bodies with custom status codes
- Reproducible data via seed for tests and demos
Best Practices
- Start with the contract (schema) before any code.
- Use the generated snippets directly in your components or MSW handlers.
- Test both happy paths and error responses early.
- Seed the random data when writing deterministic tests or Storybook stories.
Frequently Asked Questions
How realistic is the generated data?
It uses smart defaults for common fields (names, emails, dates, IDs, prices) and respects your schema structure, types, and constraints like min/max, patterns, and enums.
Can I generate error responses?
Yes. Switch between success, client error (4xx), and server error (5xx) templates. You can also customize status codes and error bodies.
Is the mock data consistent across requests?
By default it is random each time for realism. You can enable "seed" mode for deterministic output useful in tests.
Is my schema or data sent to any servers?
No. All mock generation logic and random data generation run 100% offline in your web browser. No schema details, names, or mock structures leave your device.