Skip to main content
You can create a mock server from a collection of saved response examples, from an OpenAPI spec, or as a standalone (manual) mock.

Enable the beta flag

  1. Open Preferences.
  2. Go to Beta.
  3. Turn on Mock Server.
A Mock Servers section appears in the sidebar.

Create from a collection (saved examples)

Use this path when the collection already has saved response examples.
  1. Open the collection.
  2. In the sidebar, expand Mock Servers and click the + icon to create a new mock server.
  3. Enter a Name.
  4. Under Source, select Collection and pick the collection.
  5. Keep Sync mock responses with collection examples checked, then click Create. Every saved example becomes a mock response (method, path, status, headers, and body). If you uncheck it, you can sync later from the dashboard with Sync with Examples.
  6. Click Start Server to start the mock server on the saved port. If the port is already in use, change it under Mock Server Settings (gear icon)Advanced settings.

Create from an OpenAPI spec

Use this path when you have an API spec in the workspace. Turn on API Spec under PreferencesFeatures if it is not already enabled.
  1. Load the spec under API Specs in the sidebar (if it is not already there).
  2. Create a mock server. Under Source, select API Spec and pick the spec.
  3. Keep Sync mock responses with API spec checked, then click Create. Each operation and response status becomes a mock response; bodies are derived from the schema where possible. If you uncheck it, you can generate later from the dashboard with Generate from API Spec.
  4. Click Start Server to start the mock server on the saved port. If the port is already in use, change it under Mock Server Settings (gear icon)Advanced settings.

Create a standalone (manual) mock

To add responses yourself instead of syncing from a collection or spec:
  1. Click + under Mock Servers.
  2. Enter a Name.
  3. Under Source, select Standalone.
  4. Optionally set Port and Response delay under Advanced settings.
  5. Click Create, then add responses from the Responses tab.

Port validation

The port must be a whole number between 1 and 65535. Bruno validates the port when you create, clone, or edit a mock server and when you start it, and shows an error if the port is already used by another mock server in Bruno or by another process on your system.

Where Bruno store mock servers

Mock servers are stored in the workspace at the root of the mocks folder. After creation, the mock server is saved as a .yml file.
Sample mock-server.yml file:

Next steps