Configure the mock server in your Redocly-powered API documentation using mockServer
. The mock server allows users to:
- Send requests to the Operations in your API description from Replay, cURL, or any other API client.
- Receive a sample response using information from the API description and input data.
By default, the mock server is enabled for each API description in your project. The path is configured as /_mock/<path-to-description>/
. For example, /_mock/openapi/redocly-museum/
.
Option | Type | Description |
---|---|---|
off | boolean | Turn off ("disable") the mock server. Defaults to false . |
strictExamples | boolean | If If Defaults to |
errorIfForcedExampleNotFound | boolean | Controls the response behavior of the mock server when a forced example is not found. If Defaults to |
position | string | Controls the position of the mock server in the servers dropdown in Redocly Replay. Possible values: Defaults to |
description | string | Set the description of the mock server in the servers dropdown in Redocly Replay. Defaults to Mock Server . |
This example configures the mock server in the following ways:
- Example response payloads don't substitute values from the request
- Only the mock server is available on Replay's server list
- The mock server is labeled as "Development server"
mockServer:
strictExamples: true
position: 'replace'
description: 'Development Server'
- Configure the mock server - Learn to modify mock server behavior and appearance for enhanced API testing and development
- Replay API explorer - Discover the interactive API explorer used to call the mock server and test API endpoints
- Add OpenAPI descriptions - Add OpenAPI descriptions to enable mock server functionality on the corresponding API reference documentation