An API mock server in a minute — straight from recorded traffic
Run a test API on its own port in Microkoi Bench: endpoints with a status, headers, body and delay, HTTP and HTTPS on the same port. Keep working while the backend does not exist yet, and keep responses stable for demos and automated tests.
From traffic to a mock server
- 1
Record traffic
Use your app through the proxy, and the endpoint tree collects every address it calls.
- 2
Create a server from a branch
The “Create mock server from group” button turns every method and path into an endpoint with the last recorded response.
- 3
Start it and connect
The server starts on a free port from 9091 up. Point your app at its address instead of the real API.
A real API, all your own
Everything you need so the client never waits for the backend and a demo never depends on the test environment.
Several servers at once
Each test service runs on its own port with its own endpoints: the app API on 9091, profiles on 9092.
HTTP and HTTPS on one port
The server tells the protocols apart on its own. Its certificate is issued by the Bench root certificate — for localhost, network addresses and Android emulators.
Endpoints are files in git
A server is a folder, an endpoint is a file, and the body is real JSON or an image next to it. Large responses give a line-by-line diff.
Request log
Time, method, path, status, matched endpoint and client address. A request with no endpoint gets a “Create endpoint” button.
Access from a phone
The “Network access” button opens the server to a phone, an emulator or another computer.
Any file in a response
Images, PDFs and archives are served as is, streamed from disk, including as a download.
Templates when there is no traffic yet
Ready-made APIs for common apps — an online store, food delivery, sign-in and more — with realistic lists, detail views and errors.
Export API to note
One button writes the address, endpoints, status codes, headers and sample responses into a note, so a backend developer can build the real server from it.
How it works
Endpoints with wildcards and priority
An endpoint is a method, or “any”, and a path with * and ** wildcards. If several match, the most specific one answers, by the same rules as mocks. A request with no endpoint gets a 404 with clear JSON, so you see right away what is missing.
- Folders are only for order: an endpoint’s address is set by its path
- Endpoints and folders move by drag and drop, and a whole folder can be turned on or off
- The server and each endpoint can have a plain-language description, and search finds endpoints by description too
- A running server picks up endpoint changes without a restart
- A copy of a server gets a free port and its own copies of every body
A server from a branch of traffic
A button on a host or path branch in the traffic tree creates a server with an endpoint for every method and path, with the last recorded status, headers and body. Endpoints are arranged into folders by path segment, and bodies go into files with an extension that matches their type, so images carry over too.
- Requests from different hosts and branches can go into one server: check them in the tree and click “Mock server”
- A {id} template becomes a single endpoint with * in the path, such as
/api/, and answers for any ID, even one that never showed up in trafficproduct/ * - Service headers for length, compression and connection are not carried over
- The original host address in bodies and headers is replaced with a
{{baseUrl}}placeholder, so next-page links and file URLs point at the mock server itself from any device - If a response was not stored in full, was missing, or two hosts share the same method and path, the app warns you
Templates: a server without recorded traffic
A template is a ready-made API for a common kind of app. Interface work can start before the backend: the app gets realistic lists, detail views, errors and images right away instead of empty responses.
- Eight templates in the “Content”, “Commerce”, “Social” and “Services” categories: from a food blog and an online store to token-based authentication and booking
- Search covers the name, description and tags, and before creating a server you see a preview with the description and every endpoint by folder
- The server is created stopped and on a free port. From then on it is a regular server: endpoints can be edited, and the template stays as it is
- 401, 409 and 422 errors sit turned off in the “Errors” folder: turn one on to check how your app handles it
- Responses are static: POST, PUT, PATCH and DELETE answer with fixed responses and store nothing
CORS for local development
A web app in development can call the server right away: requests from localhost, *.local and private network addresses get CORS permission automatically. Sites from the internet do not — otherwise any page open in the browser could read the server’s responses.
- An Access-Control-* header set in an endpoint replaces the automatic one
Ports and startup
The port is picked automatically and checked against the workspace’s other servers and the proxy. If a server fails to start — say, the port is taken by another program — the reason shows right in the list, with a “Try again” button next to it.
- Servers that were running start again the next time you open the workspace
- For a teammate who opens the workspace from the repository, servers neither start on their own nor open to the network
- When you switch workspaces, the previous workspace’s servers stop
Its own chaos and a contract check
Each server has its own “Chaos” button and its own profile: one server runs steadily while another next to it answers with delays, errors or dropped connections. Profile rules change on the fly, with no server restart.
- Every time Bench starts, chaos is off on all servers, and the chosen profile is kept
- An endpoint’s JSON body has a “Model” view: Bench checks it against the real endpoint’s contract and warns you when the mock falls behind the backend
- A response in the request log opens in the “Model” view too and is checked against the contract
Everything lives in the project folder
A server is stored the same way as request collections: a server folder with a server.json file, endpoints as files in folders, and each endpoint’s body as a file next to it. Changes after git pull or body edits in your code editor are picked up right away.
Questions and answers
How is a mock server different from a mock?
A mock sets a response in the proxy: your app calls the real address, and Bench answers. A mock server is a separate API on its own port: your app calls it directly, like a backend. Mocks and mock servers never overlap.
Can I call a mock server over HTTPS?
Yes, on the same port as HTTP: the server tells the protocols apart on its own. The device must trust the Bench root certificate — on a computer it is installed with a button on the traffic screen, on a phone through device setup.
How do I connect to a mock server from a phone or emulator?
Click “Network access” and use the computer’s network address shown next to the server. The Android emulator reaches your computer at 10.0.2.2.
Can I get a mock server before any traffic is recorded?
Yes. Pick a template on the section’s start screen, or create an empty server and add endpoints by hand. A template opens with a preview, and the server it creates is no different from one built from traffic.
How do I show backend developers which API the app expects?
The “Export API to note” button writes the base address, a table of contents, endpoints with descriptions, status codes, headers and sample responses, and the turned-off error variants into a note. The note sits in the “Mock servers” folder of the “Notes” section and goes into git with the workspace.
Can I keep data from traffic in endpoints?
While the server is running, any program on this computer and any page opened from a local address can read its responses. So it is better to replace real tokens and personal data in endpoints.