Mock endpoints for your APIs

If you want to build over a backend that relies on APIs that are not yet built, you can create a mock endpoint. Just define how the request and the response should look like.


Today’s topic is custom mock endpoints. If you want to build over a backend that relies on APIs that are not yet built, you can create a mock endpoint. Just define how the request and the response should look like.

A simple search for mock custom endpoints will return a good number of tools so you can choose the one that you like best. For the rest of this article, we are going to discuss some options for online and self-hosted solutions.

The benefits of using mock endpoints

The non-exhaustive list of benefits includes:

  • It's easy to spot design problems early on. When designing a feature, it's easy to overlook some aspects, and this is something that you'll usually encounter when you build and use mock endpoints. Sometimes it's as simple as the wrong payload or missing functionality that was overlooked.
  • Increase the speed of development. Your UI guru can start building on top of a mock endpoint while the backend team is busy building the actual business logic that is mocked.
  • The integration work across multiple teams is easier. What I’m talking about here is having multiple teams integrating with each other via mock endpoints so no team will get blocked by the delivery of a feature that another team handles.
  • Facilitates the creation of integration tests ahead of the actual implementation.

I'm pretty sure you can already think of additional benefits to the list above.

A very important point to add is to be careful when, and how, you use mock endpoints, as they can become a drag to maintain and keep up to date.

Online solutions

The easiest way to start with mock endpoints is to use an online tool. Your budget and needs will dictate what's the right tool for you to use and you can find a vast variety of options online.

The benefits of using such a solution are the fact you can easily share your mock with your team and anyone of you can adjust the request and response configurations as your needs grow. You don't need to install anything in your network or on your local machine and it will simply work.

I think the major disadvantages are the fact that you need to be mindful of privacy sensitive applications and the fact that the functionalities offered by the online tools will match your budget, so do your research.

There are two online solutions that I've used in the past. Both are free and quite good for what falls under basic needs:

  • Support multiple HTTP methods and status codes.
  • You can define your response payload in a variety of content types.
  • Custom HTTP Headers.
  • Configurable delays.
  • Have support for CORS Requests.

The tools I've used:

  • Mockbin is the very first tool that comes to mind. It’s free, and it supports many configurations. This is my go-to tool when I want a quick mock endpoint. A nice touch is the fact that you can create mock APIs on their platform with their APIs.
  • Mocky is the second tool that I've used. It has the basic functionality that you would need and, if you are wondering why I've needed this one as well, I've used it in the past when building a load testing tool because the responses were faster than those from Mockbin (but with fewer features overall).
  • Postman might be familiar to you because of their API Client but they offer much more tools and, for the paying customers, you have the possibility of creating mock servers.

Self-hosted solutions

If you are have concerns about privacy and you are not afraid to roll up your sleeves and get to know the tool, then a self-hosted solution might be the better alternative for you.

The benefit of using such a solution is that everything lives on your machine or your organization network. This means that you don't need to store your sensitive response models on a server in a town you can't properly spell out. It's also easier for a team to keep the mock endpoints up to date and to integrate them in your build process.

Self-hosted solution come with their own set of challenges, those being mainly the fact that it will require extra work on your part to set up and are more complex. It’s also entirely your responsibility of keeping them up and running.

A great place to start is:

  • Interceptor is a browser extension. It’s very easy to use and, since it’s connected to the browser, it’s useful for UI development.
  • Mox is a pretty cool tool. It will handle your mock endpoints and also provide you with proxy capability, meaning that you can Mox in front of your live and mock APIs as well.
  • Mock-Server is a popular choice and, if you’re not afraid of coding, try it.


We've discussed mock endpoints and we've seen some candidates that are available online and some that can be self-hosted.

In the end, mock endpoints are not right for every team or project, so please be sure to try some options for a while before committing too much effort into adopting a mock endpoints solution.

Subscribe to HTTPULSE

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.