{"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"redocly-configuration-file","__idx":0},"children":["Redocly configuration file"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can configure all of your Redocly tools using a single ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly.yaml"]}," configuration file in the root of your project. Your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly.yaml"]}," configurations can be used locally, in CI, or on our hosted platforms to specify the following behaviors:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The rules to apply to your APIs and how strictly to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lint"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The styles and features to use when rendering your API documentation."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Project-aware configuration for the VSCode extension."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Redocly CLI searches for the file in the local directory, or you can specify a configuration file with your command."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Our starter projects like ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["openapi-starter"]}," include the file for you to edit."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"example-redocly-configuration-file","__idx":1},"children":["Example Redocly configuration file"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An example is worth a thousand words, or so they say. Here's a simple configuration file showing some of the options available and how to use them."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"extends:\n  - recommended\n\napis:\n  core@v2:\n    root: ./openapi/openapi.yaml\n    rules:\n      no-ambiguous-paths: error\n  external@v1:\n    root: ./openapi/external.yaml\n    openapi:\n      hideLoading: true\n\nopenapi:\n  schemasExpansionLevel: 2\n  showExtensions: true\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Read on to learn more about the various configuration sections and what you can do with each one."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"using-configuration-with-redocly-cli","__idx":2},"children":["Using configuration with Redocly CLI"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Some of the Redocly CLI commands, such as the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v2/commands/lint"},"children":["lint command"]},", use the API names from the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apis"]}," object as shortcuts for referencing API descriptions."," ","You can tell the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lint"]}," command to validate specific API descriptions by using their names from the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apis"]}," object, like in the following example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"redocly lint core@v2\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["On the other hand, if you run the command without specifying any aliases, it applies to all API descriptions listed in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apis"]}," object of the configuration file."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"redocly lint\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This runs the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lint"]}," command for every API defined in the configuration file."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"configuration-file-overview","__idx":3},"children":["Configuration file overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Learn about the various sections of the config file, and follow the links for detailed documentation for each."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"id":"extends-list"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"expand-existing-configuration-with-extends","__idx":4},"children":["Expand existing configuration with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extends"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extends"]}," to adopt an existing ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v2/rules#rulesets"},"children":["ruleset"]}," such as the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["recommended"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["minimal"]}," standards."," ","You can also define your own rulesets and refer to them here by file path or URL."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["While the order of the sections in the configuration file doesn't matter, usually ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extends"]}," is first, and any later rules, preprocessors or decorators defined in this file then override the base settings."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Read the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v2/configuration/extends"},"children":["detailed ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extends"]}," documentation"]}," to see more information and examples."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"configure-linting-rules","__idx":5},"children":["Configure linting ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rules"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rules"]}," section, configure which rules apply, their severity levels, and any options that they support."," ","Configurable rules, and rules from custom plugins are also configured here."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this section to adjust the linting rules from the rulesets or other base configuration set in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extends"]},", and fine-tune it to meet the needs of your API. Here's an example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly.yaml"]},", changing some rule severity, and using some additional configuration for a rule."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"rules:\n  no-unused-components: error\n  operation-singular-tag: warn\n  boolean-parameter-prefixes:\n    severity: error\n    prefixes: ['can', 'is', 'has']\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also define your ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/rules/configurable-rules"},"children":["configurable rules"]}," here."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information and examples, visit the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v2/configuration/rules"},"children":["configuring rules documentation"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"lint-markdown-with-recheck","__idx":6},"children":["Lint Markdown with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["recheck"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v2/commands/recheck"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["recheck"]}," command"]}," lints Markdown files from the same configuration file."," ","Add a Recheck preset such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["recheck/markdown"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["extends"]},", and adjust its rules in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["recheck"]}," block:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"extends:\n  - recommended\n  - recheck/markdown\nrecheck:\n  rules:\n    recheck/line-length: off\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lint"]}," command ignores the Recheck presets and the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["recheck"]}," block, and the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["recheck"]}," command ignores API rulesets."," ","For more information, visit the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v2/configuration/reference/recheck"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["recheck"]}," block reference"]}," and the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v2/recheck"},"children":["Markdown and prose linting"]}," section."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"id":"theme-object"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"configure-openapi-features-and-documentation-styles","__idx":7},"children":["Configure OpenAPI features and documentation styles"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"mockserver-object","__idx":8},"children":["mockServer object"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can apply ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mockServer"]}," to individual APIs as well as at the root (default) level."," ","In case of conflict, API takes priority."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The API registry supports ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://redocly.com/docs/api-registry/guides/mock-server-quickstart/"},"children":["the mock server feature"]}," and allows project owners to enable it for all branches per API version."," ","When the mock server is enabled for an API, you can send test requests to it from any API client."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mockServer"]}," object allows additional configuration of the mock server behavior."," ","This object is optional."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"fixed-properties","__idx":9},"children":["Fixed properties"]},{"$$mdtype":"Tag","name":"JsonSchema","attributes":{"schema":{"$ref":"./mockserver.yaml"},"options":{},"schemaResolved":{"openapi":"3.1.0","components":{"schemas":{"__root":{"$ref":"#/components/schemas/mockserver"},"mockserver":{"type":"object","title":"Mock server object","description":"Lets you toggle features that control how mock servers behave.","properties":{"errorIfForcedExampleNotFound":{"description":"You can force specific examples to appear in the response by adding the optional `x-redocly-response-body-example` header to your requests. If you pass an example ID that can't be found in the API description, the mock server returns any other example unless `errorIfForcedExampleNotFound` is `true`. Then the mock server returns an error instead.","type":"boolean","default":false},"strictExamples":{"description":"By default, the mock server automatically enhances responses with heuristics, such as substituting response fields with request parameter values. If set as `true`, examples are returned in the response unmodified, and exactly how they are described in the OpenAPI description.","type":"boolean","default":false}}}}}},"schemaResolvedErrors":[]},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"openapi-object","__idx":10},"children":["openapi object"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["openapi"]}," object configures features and theming for API documentation generated from OpenAPI descriptions."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you need to apply different theming and functionality to individual APIs, add the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["openapi"]}," property to the appropriate API in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apis"]}," object, and use the same options as the global ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["openapi"]}," object."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Find the full list of supported options on the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://redocly.com/docs/api-reference-docs/configuration/functionality/"},"children":["Reference docs configuration page"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"id":"apis-object"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"configure-each-of-the-apis-independently","__idx":11},"children":["Configure each of the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apis"]}," independently"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For organizations with multiple APIs, versions or environments, having specific configuration for each is a powerful tool."," ","All configuration options can be nested within a specific API entry."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-of-apis-configuration","__idx":12},"children":["Example of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apis"]}," configuration"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"extends:\n  - recommended\n\napis:\n  public@v2:\n    root: ./openapi/openapi.yaml\n    rules:\n      operation-4xx-response: off\n  internal@v1:\n    root: ./internal-openapi/openapi.yaml\n    rules:\n      security-defined: off\n      operation-4xx-response: off\n    decorators:\n      remove-x-internal: on\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Visit the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v2/configuration/apis"},"children":["per-API configuration page"]}," for detailed documentation and more examples."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"id":"plugins-list"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"use-custom-plugins","__idx":13},"children":["Use custom ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["plugins"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this list to import any custom plugins (omit this section if you have no plugins). Custom plugins are used to add any custom decorators or rules that you want to use, that aren't provided by the Redocly ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/rules/built-in-rules"},"children":["built-in rules"]},", ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/rules/configurable-rules"},"children":["configurable rules"]},", or existing ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v2/decorators"},"children":["decorators"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add each plugin by path, relative to the configuration file, to have the plugin contents available to configure."," ","Importing by URL isn't supported, to reduce the risk of malicious code execution."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Find more information on the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/cli/v2/custom-plugins/custom-config"},"children":["configuration in plugins"]}," page."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"plugin-import-example","__idx":14},"children":["Plugin import example"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["plugins"]}," section to import as many plugins as you need to refer to in your config file."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"plugins:\n  - './local-plugin.js'\n  - './another-local-plugin.js'\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The rules, decorators, pre-processors and configuration contained in the plugins become available to your configuration file."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"id":"resolve-object"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"resolve-non-public-or-non-remote-urls","__idx":15},"children":["Resolve non-public or non-remote URLs"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Redocly automatically resolves any API registry link or public URL in your API descriptions."," ","If you want to resolve links that are neither API registry links nor publicly accessible, set the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["resolve"]}," object in your configuration file."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Redocly CLI supports one ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http"]}," header per URL."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"fixed-properties-1","__idx":16},"children":["Fixed properties"]},{"$$mdtype":"Tag","name":"JsonSchema","attributes":{"schema":{"$ref":"./resolve.yaml"},"options":{},"schemaResolved":{"openapi":"3.1.0","components":{"schemas":{"__root":{"$ref":"#/components/schemas/resolve"},"resolve":{"type":"object","title":"Resolve object","description":"All API registry links and public URLs in your API descriptions automatically resolve. If you want to resolve links that are neither API registry links nor publicly accessible, include this object to add an HTTP request header.\nIf the URL matches multiple patterns, the first match takes priority. The header from the first match is used in the request.\nUse environment variables where possible.","properties":{"doNotResolveExamples":{"type":"boolean","description":"Set this option to `true` to prevent resolving `$ref` fields in singular `example` properties. This affects both `lint` and `bundle` commands. This does not affect `$ref` resolution in other parts of the API description.","default":false},"http":{"type":"object","description":"Description of URL pattern matches and the corresponding headers to use when resolving references.","properties":{"headers":{"type":"array","minItems":1,"items":{"type":"object","required":["matches","name"],"properties":{"matches":{"type":"string","description":"The URL pattern to match. For example, `https://api.example.com/v2/**` or `https://example.com/*/test.yaml`"},"name":{"type":"string","description":"The header name. For example, `X-API-KEY`."},"value":{"type":"string","description":"The value of the header. Mutually exclusive with `envVariable`. We recommend to use `envVariable` instead for any secrets."},"envVariable":{"type":"string","description":"The environment variable name resolved which should contain the value. Mutually exclusive with `value`."}}}}}}}}}}},"schemaResolvedErrors":[]},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example","__idx":17},"children":["Example"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here is an example for adding header definitions:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"resolve:\n  http:\n    headers:\n      - matches: https://api.example.com/v2/**\n        name: X-API-KEY\n        envVariable: SECRET_KEY\n      - matches: https://example.com/*/test.yaml\n        name: Authorization\n        envVariable: SECRET_AUTH\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The first match takes priority when a URL matches multiple patterns."," ","Therefore, only the header from the first match is used in the request."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"split-up-the-configuration-file","__idx":18},"children":["Split up the configuration file"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["As your config file grows, you may want to split it into multiple parts."," ","Splitting a config file is possible by using references in a config similar to how they are used in OpenAPI descriptions:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"extends:\n  - recommended\nopenapi:\n  $ref: ./openapi-theme.yaml\nmockServer:\n  $ref: ./mockserver.yaml\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["push"]}," command with a config file that includes ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["$ref"]},"s, all referenced files are explicitly uploaded using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--files"]}," option."]}]}]},"frontmatter":{"seo":{"title":"Redocly CLI configuration","description":"Learn how to configure Redocly CLI"},"toc":{"maxDepth":3}},"tagList":["admonition","html","json-schema"],"title":"Redocly CLI configuration","lastModified":"2026-10-05T09:58:30.000Z"}