Mock API Generator
Generate instant mock API endpoints for testing. Create fake REST APIs with custom responses. No backend needed.
Nothing leaves your browser. All processing happens locally.
Templates:
Endpoint Preview
GET
/api/users→200Integration Code
Express.js Server
const express = require("express");
const app = express();
app.get("/api/users", (req, res) => {
res.status(200).json([
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"role": "admin"
},
{
"id": 2,
"name": "Jane Smith",
"email": "jane@example.com",
"role": "user"
},
{
"id": 3,
"name": "Bob Wilson",
"email": "bob@example.com",
"role": "user"
}
]);
});
app.listen(3001, () => console.log("Mock server running on http://localhost:3001"));MSW (Mock Service Worker)
import { http, HttpResponse, delay } from "msw";
export const handlers = [
http.get("/api/users", async () => {
return HttpResponse.json([
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"role": "admin"
},
{
"id": 2,
"name": "Jane Smith",
"email": "jane@example.com",
"role": "user"
},
{
"id": 3,
"name": "Bob Wilson",
"email": "bob@example.com",
"role": "user"
}
], {
status: 200,
});
}),
];Next.js API Route
// app/api/mock/users/route.ts
import { NextResponse } from "next/server";
export async function GET() {
return NextResponse.json([
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"role": "admin"
},
{
"id": 2,
"name": "Jane Smith",
"email": "jane@example.com",
"role": "user"
},
{
"id": 3,
"name": "Bob Wilson",
"email": "bob@example.com",
"role": "user"
}
], {
status: 200,
});
}How to Use
1
Define your mock JSON response in the editor
2
Configure options like status code, delay, and custom headers
3
Use the generated data URL as your API endpoint (works in browser)
4
For persistent endpoints, use the generated code snippets