About this feature
The mock server feature is only available to Pro and Enterprise customers.
Only users with the
Admin project-level role for an API can enable the mock server feature.
The mock server feature is disabled by default.
To enable the mock server:
- On the API registry page, select the API for which you want to enable mock server feature. The API Overview page displays.
- From the top, navigate to Settings > Mock servers .
Enable mock servers for all branches
box and click
Optionally enable the mock server in your production or preview API docs by selecting your desired option.
off: Doesn't add the mock server URL to the servers list.
first: Adds the mock server URL as the first item in the servers list in the Try It console.
last: Adds the mock server URL as the last item in the servers list in the Try It console.
replace: Replaces the servers list with the mock server URL.
Redocly generates mock servers for your primary and preview branches.
If you enable the mock server in your product API docs, the primary branch rebuilds.
Preview API docs aren't rebuilt automatically, and changes are applied with the next build.
You can trigger a preview branch rebuild manually.
To further control the mock server behavior, use the mockServer object in your Redocly configuration file. Note that you must add the configuration file to your API project in the registry for settings to apply.
Read more on how to use the mock server feature.