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.
Mock Servers are in Beta. They are on by default and appear in the sidebar. To hide them, turn off Mock Server under Preferences → Beta.

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.
  1. 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 mock server linked to a collection

Create from an OpenAPI spec

Use this path when you have an API spec in the workspace. Turn on API Spec under Preferences → Features if it is not already enabled.
  1. Load the spec under API Specs in the sidebar (if it is not already there).
  2. Create the mock server in either way:
    • Right-click the spec (or open its actions menu) and choose Create Mock Server. Bruno opens the modal with API Spec as the source and that spec already selected.
    API Spec sidebar menu with Create Mock Server
    • Or click + next to Mock Servers, set Source to API Spec, and pick the spec.
    Create mock server linked to an API spec
  3. Keep Sync mock responses with API spec checked, then click Create.
Before Bruno creates the mock server, it validates the selected spec. The spec must be valid YAML or JSON, declare an openapi or swagger version, include an info object, and define at least one path. If any check fails, Bruno shows the error under the spec field and does not create the mock server. Each operation and response status becomes a mock response; bodies are derived from the schema where possible. If you uncheck sync, you can generate later from the dashboard with Generate from API Spec.
  1. 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.
For the full API Spec menu (Generate Collection, Rename, Clone, Remove, Delete, and more), see Manage an API Spec from the sidebar.

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.
Create a standalone mock server

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 stores 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