HTTP mocking for development and testing

MockAPI
Configure the response.
Test your application.

MockAPI is an open-source, self-hosted mock API server designed for efficient request handling and a small memory footprint. Configure status codes, headers, and response bodies through the dashboard or a JSON file. Use it to test successful requests, rate limits, server errors, and connection failures. Endpoint changes take effect without a restart.

Getting started

Run your mock API locally or in a container

Local development

Run locally

Install the stable .NET 11 SDK, then clone and run. No Node.js tooling is needed just to use MockAPI.

git clone https://github.com/simonkurtz-MSFT/MockAPI.git
cd MockAPI
PowerShell 7
.\start.ps1 -Action run-tutorial
Bash
./start.sh --action run-tutorial

The dashboard opens automatically when MockAPI is ready. If your browser does not open, visit localhost:5080/__mockapi/ .

Isolated runtime

Use a container

Run a published stable image without an SDK or source checkout. The same tag supports Linux AMD64 and ARM64.

docker run --rm -p 127.0.0.1:8080:8080 -v mockapi-data:/data simonkurtzmsft/mockapi:1.11.0

Open localhost:8080/__mockapi/ . The named volume preserves configuration across restarts. Use an explicit published version; there is no latest image alias.

Browse published images

To develop container changes from source, build with Docker instead:

PowerShell 7
.\start.ps1 -Action container-build -ContainerEngine docker
.\start.ps1 -Action container-run -ContainerEngine docker
Bash
./start.sh --action container-build --container-engine docker
./start.sh --action container-run --container-engine docker

WSLC, persistence, and platform guide

Make your first request

  1. Open the dashboard and select Load examples .
  2. Press the play button for /inventory/items (Trailhead Supply inventory).
  3. Changes are saved automatically to your configured writable file, volume, or Azure Blob Storage.

Keep administration private and APIs protected. Before sharing a deployment, configure administrative authentication, HTTPS, and API key protection.

Common uses

Mock API examples for development and testing

Exercise retry behavior

Return HTTP 429 with Retry-After, configure server errors, or abort a connection. Check how your client handles these failures without changing the upstream service.

Configure a response

Keep test configuration in source control

Import and export endpoint definitions as JSON. Review configuration changes in source control or automate them through the management API.

Use the management API

Features

A small, hardened container for your mock APIs

Minimal Native AOT image

Ship only the compiled application and its dependencies. The final image contains no .NET SDK, managed runtime, JIT, compiler, or debug symbols.

See measured image and memory results

Hardened by default

Run as a non-root user, disable runtime diagnostics, support a read-only root filesystem, and protect mock calls with an API key by default.

Review security options

Import, save, and export

Import endpoint definitions, save changes to storage, and export requests as Postman, Insomnia, cURL, JMeter, OpenAPI, k6, or HTTP files.

Explore configuration workflows

Live request view

Watch recent matched requests in the dashboard with timestamps, outcomes, status codes, response sizes, and retry attempt counts.

Understand request statistics

APIM Samples integration

Easily connect APIM Samples to your custom mock APIs. Import live OpenAPI definitions into Azure API Management and use MockAPI as the backend for your scenarios.

Connect custom APIs to APIM
Explore MockAPI on GitHub