API Evangelist API Evangelist
Guidance
API Learnings
APIs
API Governance
API Solutions
API Discovery
API Building Blocks
API Evangelist LLC

Mocking

Simulating API responses before the backend is built

Mocking is the practice of simulating an API’s responses before the real backend exists, and it’s one of the most underrated capabilities in the entire API lifecycle. A mock API returns realistic, structured responses that look like what the real API will eventually return, but without any of the actual backend logic, data, or infrastructure behind it. This sounds modest, but it’s transformative for how APIs get built, because it means you can have a working API — one that consumers can call and build against — before you’ve written a single line of backend code. Mocking is what makes design-first API development real: you design the contract, generate a mock from it, and immediately have something people can interact with, give feedback on, and start integrating with, all while the real implementation is still being built. The mock turns the API definition from a document into a running thing.

The connection between mocking and API definitions is what makes modern mocking so powerful, and it’s the insight I’ve emphasized most. I wrote in 2016 that if you use API definitions, there’s no excuse for not having an API sandbox — because once you have an OpenAPI definition, generating a mock from it is nearly free. The definition already specifies the paths, the operations, the request and response schemas, and the examples; a mock server just reads that definition and serves up responses that match it. This is the design-first dividend: the same OpenAPI definition that drives your documentation, your tests, and your SDK generation also drives your mock. Stripe’s OpenAPI-driven mock server, which I wrote about in 2017, was an excellent example — a mock generated directly from the API’s definition, giving developers a way to build and test against Stripe’s API behavior without touching real payment infrastructure. The definition is the source, and the mock is one of the most valuable things you can derive from it.

Mocking enables design-first development, which is the workflow shift I’ve advocated for most consistently. I wrote in 2020 about using API mocks as part of an API-first workflow — the practice of designing the API contract, generating a mock, and letting consumers start building against that mock immediately, in parallel with the backend team building the real implementation. This breaks the traditional bottleneck where consumers have to wait for the backend to be done before they can start. With mocking, the frontend team, the mobile team, the partner integrations, and the documentation can all proceed against the mock while the backend catches up, and because everyone is building against the same definition-driven mock, the pieces fit together when the real implementation arrives. I even speculated in 2018 about a mock-only API development reality — the provocative idea that you could do an enormous amount of API development and validation entirely against mocks before committing to building the real thing. The mock lets you validate the design with real usage before you’ve paid the cost of implementation.

The data dimension is where mocking gets interesting and sometimes hard, because a mock is only as useful as the data it returns. A mock that returns the same static response every time is useful for basic integration but limited for realistic testing. This is where synthetic data comes in — generating realistic, varied, fake data that makes a mock behave like a real API with real records. I wrote about running synthetic data and content through your APIs, about synthetic healthcare records using Synthea, and about tools like Mockaroo for generating synthetic data. The healthcare examples are particularly instructive: you can’t test against real patient data for privacy reasons, so synthetic data that’s realistic but fake is essential for mocking and developing healthcare APIs. The spectrum runs from static mocks (the same canned response) through dynamic mocks (responses that vary based on the request) to fully synthetic-data-backed mocks (a realistic fake dataset behind the mock), and the right point on that spectrum depends on what you’re trying to accomplish.

Mocking sits firmly in the API lifecycle as a first-class stage, and I documented it as such. I wrote about mocking in the API lifecycle basics, because it’s a genuine, distinct lifecycle concern — not an afterthought but a deliberate practice with its own tooling and its own place in the flow from design to deployment. Postman became a major mocking platform, and I tracked the state of mock APIs in Postman over the years, including using Postman mock servers to generate static APIs and to mock services like AWS for development. The tooling matured to the point where mocking is now a routine capability: define your API, spin up a mock, develop against it. The mock is part of the standard toolkit, alongside documentation, testing, and the gateway, all derived from the same definition.

The newest frontier connects mocking to testing and to the agent era, and it shows mocking’s enduring relevance. Microcks emerged as a powerful open-source tool for mocking and testing APIs from their definitions, and I wrote in 2026 about an MCP server for Microcks mocking and testing — bringing mocking capabilities to AI agents so that an agent can discover, configure, and test against mocked APIs in a sandbox. This is mocking doing exactly what it’s always done — providing a safe, realistic, backend-free environment to develop and test against — now extended to the newest kind of consumer. The throughline across the whole history of mocking is that it’s one of the highest-leverage things you can generate from a good API definition: a running, callable simulation of your API that lets development proceed in parallel, lets consumers integrate before the backend is ready, lets you validate your design with real usage, and lets testing happen against a controlled, realistic environment. Mocking is the proof that a good API definition isn’t just documentation — it’s a generative source from which you can produce a working API before the real one exists. That’s a small miracle of the design-first approach, and it’s one of the most practical reasons to invest in good machine-readable definitions in the first place.

References