# Mock servers

> Start a mock server on your computer from a collection's examples or an OpenAPI document.

Canonical: https://porticol.app/docs/mock-servers

[View as Markdown](https://porticol.app/docs/mock-servers.md)

Commands: `New mock`, `Show mocks`

A mock server answers requests with the examples saved on a collection's requests, or with responses described in an OpenAPI document, so you can build against an API that isn't there yet.

## On your computer

Choose **New mock server…** in the command palette, or open the Mocks section, which **Show mock servers** opens too. Pick the source, a collection or an OpenAPI document pasted or chosen from a file, and the port. You can also set:

- a delay before every answer, in milliseconds
- a fault, given to one request in every so many
- strict matching, which refuses query parameters no example names
- scenarios, where a request's answer depends on the state the mock server is in, and moves it to the next state

The mock server listens on your computer's loopback address only and refuses a request for any other host name, so a web page can't reach it by pointing a name of its own at it. It never replays the CORS or `Set-Cookie` headers of a saved example.

Its request log lists the last 1,000 requests it answered, with their method, path, status and time, but not their headers or bodies. A mock server on your computer runs while Porticol is open, and only the desktop app can start one.
