Mock API Server

Design Mock APIs in Seconds

Create realistic API endpoints with custom responses, status codes, and delays. Perfect for frontend development, demos, and integration testing.

Note

This tool helps you design and document mock APIs. To expose them on the internet you can copy the generated configuration into tools like json-server, Express, or online mock API platforms.

Use {{VARIABLE_NAME}} for environment variables: API_BASE_URL, JWT_SECRET, DATABASE_URL, STRIPE_SECRET_KEY
Use {{random:TYPE}} for random data: id, uuid, name, email, timestamp, boolean, number, status

Example Request (cURL)

Use this in your docs or API client
curl -X POST -H "Content-Type: application/json" -d '{"token":"ey.fake.jwt.token","user":{"id":"user_123","name":"Jane Doe","email":"jane@example.com","roles":["admin","editor"]}}' "https://mock-api.sourcecodestack.com/auth/login"

Simulated Response

Status: 200Delay: 120ms
// Click "Test Endpoint" or "Webhook" to simulate a response

What is Mock API Server?

Mock API Server is a free, browser-based tool that lets you create simulated API endpoints for frontend development and testing — without needing a real backend server. Define custom routes with specific HTTP methods, status codes, response bodies, and headers, then use them to test your application's behavior against different API scenarios. It is ideal for prototyping, testing error handling, simulating slow responses, and developing frontend features before the backend is ready.

How to Use

  1. Click Add to create a new mock endpoint. Specify the HTTP method (GET, POST, PUT, DELETE, etc.) and the route path.
  2. Configure the response — set the status code, response body (JSON, XML, plain text), and custom headers for each endpoint.
  3. Optionally add response delays to simulate slow network conditions or server processing time.
  4. Use the generated endpoint URL in your frontend application or API client to test against your mock responses.
  5. Monitor incoming requests in the webhook history panel to see how your application interacts with the mock endpoints.

Why Use Our Mock API Server?

  • No backend needed — Start developing frontend features immediately without waiting for backend APIs to be built. Define mock responses and iterate on your UI independently.
  • Test edge cases — Simulate error responses (404, 500), slow connections, and unexpected data formats to ensure your application handles all scenarios gracefully.
  • Custom responses — Full control over status codes, response bodies, headers, and delays. Create realistic API simulations that match your production specifications.
  • Request logging — Monitor every request that hits your mock endpoints with detailed logs including headers, body, and timestamps for debugging.
  • Browser-based and free — No installation, no server setup, no account required. Everything runs in your browser and your mock configurations stay local.

Frequently Asked Questions

Can I use this to test my frontend application?

Yes. The Mock API Server is designed exactly for this purpose. Create endpoints that mirror your planned API structure, configure the responses, and point your frontend to the mock URLs during development.

How do I simulate a server error?

When creating or editing an endpoint, set the status code to any error code you want to test — such as 400 (Bad Request), 403 (Forbidden), 404 (Not Found), or 500 (Internal Server Error). You can also customize the error response body to match realistic error formats.

Can I add response delays?

Yes. Each endpoint supports configurable response delays in milliseconds. This is useful for testing loading states, timeout handling, and how your UI behaves under slow network conditions.

Are my mock configurations saved?

Mock configurations persist in your browser session. For long-term storage, you can export your endpoint definitions and re-import them later. Your data stays local and is never sent to any server.

Does this replace tools like Postman or Mockoon?

This tool complements them. It is lighter and requires zero setup — just open the page and start mocking. For complex scenarios like chained responses, conditional logic, or team collaboration, dedicated tools like Postman or Mockoon offer additional features.

What Is a Mock API Server?

A mock API server is a simulated backend that responds to HTTP requests with predefined data, without real business logic, database, or infrastructure. It solves one of the most common friction points in development: frontend and backend teams working in parallel on the same feature. When the frontend team needs an endpoint the backend team has not built yet, work stalls. A mock API breaks this dependency — frontend developers build against a working simulation immediately, while backend developers implement the real thing in parallel.

Mock, stub, and fake are often confused. A stub returns a hardcoded response regardless of input. A mock verifies it was called in specific ways and simulates scenarios based on input. A fake is a working implementation with simplified behavior (like an in-memory database). In everyday usage, "mock API" typically means stub-level behavior: define an endpoint, define its response, done.

Modern mock servers go well beyond simple stubbing. They support configurable HTTP status codes to simulate errors (404, 500, 429), artificial response delays to test loading state UI, request validation to ensure callers send the expected shape, and response templates with dynamic data generation. This makes them invaluable for building robust test suites covering edge cases that would be difficult or destructive to trigger against a real backend — like testing what happens when a payment service returns 503.

Common Use Cases

  • Frontend prototyping and parallel development — Build and iterate on UI components, data tables, and forms against realistic API responses before real backend endpoints exist.
  • Automated testing and CI pipelines — Tests run against mock endpoints returning deterministic responses, making them fast, isolated, and repeatable without external service dependencies.
  • Demo and staging environments — Showcase products at conferences or to investors without risking exposure of real user data or dependence on a fragile production environment.
  • Simulating error scenarios — Trigger 500 errors, rate-limit responses, and network timeouts to verify the frontend handles failures gracefully with appropriate error messages and fallback states.
  • API documentation and onboarding — Provide new team members and external partners with a live, explorable mock so they can send real requests and see real responses before getting production credentials.

Frequently Asked Questions

What is a mock API?

A mock API is a simulated web service that accepts HTTP requests and returns predefined responses, mimicking a real API without real infrastructure. You define the endpoint path, HTTP method, status code, and response body — typically a JSON payload. Your application hits that URL and receives a realistic response instantly, allowing development to proceed without a real backend.

Mock API vs real API — what is the difference?

The real API executes actual business logic — queries a database, applies rules, sends emails, charges credit cards. A mock only returns what you configured; no writes persist, no logic executes. The value of a mock is behavioral consistency for the contract (URL, method, headers, response shape), not functional correctness. Once the real API is built, integration testing against it is essential before shipping.

How do I simulate API errors?

Configure a mock endpoint to return the desired HTTP error status — 404 for not found, 500 for server error, 429 for rate limiting, 503 for service unavailable — with an appropriate error response body. Advanced mock servers let you configure conditional responses: return 200 for valid requests and 404 for unrecognized IDs. Adding a simulated delay lets you test timeout handling and loading spinners realistically.

Can I use a mock API in production?

No — mock APIs do not persist data, enforce business rules, validate security, or integrate with real systems. Users interacting with a mock-backed production app would lose all data. The only exception: graceful degradation patterns that fall back to canned responses when a downstream service is unavailable — but this is handled intentionally in application code, not by routing real traffic to a mock server.

What is API contract testing?

API contract testing verifies that a consumer (frontend) and a provider (backend) agree on the API shape — exact URLs, methods, request schemas, and response schemas. Tools like Pact formalize this contract: the consumer generates a contract file from mock interactions, and the provider runs tests to verify it satisfies every contract. This catches breaking changes — like a backend developer renaming a JSON field — before they reach production.