# Per-API configuration

Use the `apis` object to configure one or more APIs separately from the main configuration.
Every API in the object is identified by its unique name.

For every API listed in the object, you must provide the path to the OpenAPI description using the `root` property.

If `rules`, `decorators`, or `preprocessors` aren't defined for an API, root settings are used.
If `rules`, `decorators`, or `preprocessors` are defined for an API, they apply together with the root configuration.
If the same `rules`, `decorators`, or `preprocessors` are defined on `apis` and the root level, per-API `rules`, `decorators`, and `preprocessors` override the root ones.

For example, if you include the same `decorator` at the root level and for a specific API, but with different properties, the API-level settings replace the root ones.

So if you have the following `redocly.yaml` configuration, adding `filter-in` and `plugin/change-title` at the root level and applying `plugin/change-title` with a different `title` property to the `storefront` API:


```yaml
decorators:
  filter-in:
    property: x-products
    value:
      - Core
  plugin/change-title:
    title: All APIs
    extraProperty: This property will be ignored at the per-API level.


apis:
  storefront:
    decorators:
      plugin/change-title:
        title: Storefront APIs
```

The `plugin/change-title` decorator with the "Storefront APIs" `title` property is applied to the `storefront` API with the value `Storefront APIs`, and the `filter-in` decorator is also applied to the `storefront` API.

For all other APIs, not including the `storefront` API, `filter-in` and `plugin/change-title` with the "Core" `title` and `extraProperty` properties are applied.

## Patterned properties


```json
{
  "$ref": "#/components/schemas/api",
  "components": {
    "schemas": {
      "api": {
        "type": "object",
        "title": "APIs object",
        "description": "Lets you configure one or more API description files. This gives you the flexibility to reference specific files in commands, and configure each file at a granular level.",
        "additionalProperties": {
          "x-additionalPropertiesName": "{name}",
          "type": "object",
          "title": "API object",
          "required": [
            "root"
          ],
          "description": "Specifies the name of an API associated with the root API description.",
          "properties": {
            "root": {
              "type": "string",
              "description": "The path to the root API description file of the specified API."
            },
            "output": {
              "type": "string",
              "description": "The path to the output file produced by the `bundle` command."
            },
            "preprocessors": {
              "type": "object",
              "title": "Preprocessors object",
              "description": "Change the severity level of any preprocessors in your extended configurations. Preprocessors run first during `lint` and `bundle`.",
              "additionalProperties": {
                "description": "List each preprocessor by name. For example, `do-this-first`.",
                "oneOf": [
                  {
                    "type": "string",
                    "description": "Specifies the severity level as a string shortcut (or more explicitly as an object).",
                    "enum": [
                      "on",
                      "off"
                    ]
                  },
                  {
                    "type": "object",
                    "description": "Specifies the severity level as an object. Useful when you need to supply additional properties for configuration.",
                    "properties": {
                      "severity": {
                        "type": "string",
                        "enum": [
                          "on",
                          "off"
                        ],
                        "description": "The severity level if the problem occurs."
                      }
                    },
                    "additionalProperties": true
                  }
                ]
              }
            },
            "rules": {
              "type": "object",
              "title": "Rules object",
              "description": "Change the severity level of any rules in your extended configurations. Some rules may also receive additional configurations. Rules run during the `lint` command after preprocessors.",
              "additionalProperties": {
                "description": "List each rule by name. For example, `no-empty-servers`.",
                "oneOf": [
                  {
                    "type": "string",
                    "description": "Specifies the severity level as a string shortcut (or more explicitly as an object).",
                    "enum": [
                      "error",
                      "warn",
                      "off"
                    ]
                  },
                  {
                    "type": "object",
                    "title": "Rule configuration object",
                    "description": "Specifies the severity level as an object. Useful when you need to supply additional properties for configuration.",
                    "required": [
                      "severity"
                    ],
                    "properties": {
                      "severity": {
                        "type": "string",
                        "enum": [
                          "error",
                          "warn",
                          "off"
                        ],
                        "description": "The severity level if the problem occurs."
                      }
                    },
                    "additionalProperties": true
                  }
                ]
              }
            },
            "decorators": {
              "type": "object",
              "description": "Used to enable or disable decorators. Decorators run during the `bundle` command after linting.",
              "additionalProperties": {
                "description": "List each decorator by name. For example, `remove-x-internal`.",
                "oneOf": [
                  {
                    "type": "string",
                    "description": "Specifies the severity level as a string shortcut (or more explicitly as an object).",
                    "enum": [
                      "off",
                      "on"
                    ]
                  },
                  {
                    "type": "object",
                    "title": "Decorator configuration object",
                    "description": "Specifies the severity level as an object. Useful when you need to supply additional properties for configuration.",
                    "properties": {
                      "severity": {
                        "type": "string",
                        "enum": [
                          "on",
                          "off"
                        ],
                        "description": "The severity level if the problem occurs."
                      }
                    },
                    "additionalProperties": true
                  }
                ]
              }
            },
            "extends": {
              "type": "array",
              "description": "Inherits configurations. In case of conflicts, priority goes to configurations further down the list. Explicit inline declarations take precedence over configurations inherited through the `extends` feature. Built-in configurations include `recommended` and `minimal`.",
              "items": {
                "type": "string",
                "example": "recommended"
              }
            },
            "openapi": {
              "type": "object",
              "description": "Defines theming and functionality for an API description. Supports the same format and options as the [root `openapi` object](https://redocly.com/docs/api-reference-docs/configuration/functionality/). API-level configuration always overrides the root configuration."
            },
            "mockServer": {
              "type": "object",
              "description": "Defines mock server behavior for an API description. Supports the same format and options as the root `mockServer` object. API-level configuration always overrides the root configuration."
            }
          }
        }
      }
    }
  }
}
```

## Example


```yaml
apis:
  name:
    root: ./openapi/openapi.yaml
    openapi: {}
    output: ./openapi/bundled.yaml
```

Important
Per-API configurations take priority over global settings.