Skip to content

Mock server

The mock server answers requests on your Mac with responses from your history or from an OpenAPI file. Use it to build a front end before the API exists, or to test without hitting a real server.

Press ⌘K and choose Mock server (from History or an OpenAPI file)…. Pick where responses come from:

  • History: the latest response for each method and path, with its status, content type and body.
  • An OpenAPI file: the first 2xx response’s example for each operation, or a sample built from the schema when there’s no example.

The server listens on http://127.0.0.1:<port>, on your Mac only.

  • Path parameters match any value. Exact paths win.
  • Each route can wait a set time before answering, to simulate a slow API.
  • Unknown paths get a 404 that lists the available routes.

The log shows each request the mock server receives. The server stops when you close the folder.

Terminal window
courier mock api.openapi.yaml --port 4010 --delay 200

The CLI serves OpenAPI examples until you press CtrlC. --port 0 picks a free port.