# Mock Server

> A fake API that sends back set answers, for building and testing.

**Field:** Software Development  
**Category:** APIs  
**Also known as:** Mock API, API Mock, Fake API Server

## Think of it like

Think of it like a cardboard shop front on a film set. It looks real enough to act in front of.

## Definition

A mock server is a fake API that sends back set answers. It copies the real API's endpoints and replies. Front-end teams use one to build before the real API exists. Tests use one so they do not hit a slow or costly real service. It can also fake errors that are hard to cause for real.

## Example

Jack's app team builds the checkout screen against a mock server. The real payments API is not ready for two weeks.

## Why it matters

Teams stop waiting on each other. Tests stop needing outside services.

## Common mistake

Letting the mock drift from the real API. Tests then pass against answers the real one never sends.

## Three principles

- **Set answers.** It replies the same way each time.
- **Build early.** No need to wait for the real API.
- **Keep it in step.** Match the real contract.

## Related terms

- [API Testing](https://learn.benibix.com/term/development/api-testing)
- [Contract Testing](https://learn.benibix.com/term/development/contract-testing)
- [API-First Design](https://learn.benibix.com/term/development/api-first-design)
- [Mock (Testing)](https://learn.benibix.com/term/development/mock)
- [OpenAPI Specification](https://learn.benibix.com/term/development/openapi)

## Told apart from

- [Mock vs Mock Server](https://learn.benibix.com/compare/mock-vs-mock-server): A mock is a fake object inside one test, in the same program. A mock server is a fake API that runs on its own, over the network. Many tests and apps can call the same mock server.

![Two panels. API testing: a test sends a request straight to the API, with no screen, and checks the status code, the body and the speed. Contract testing and mock servers, lit up: a frontend team tests against a mock server that copies the API, while the backend team is still building it. A shared contract file sits between them, and both sides are tested against it.](https://learn.benibix.com/diagrams/dev3-api-testing.svg)

---

Source: https://learn.benibix.com/term/development/mock-server
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
