# `openapi`

Customize the behavior and appearance of OpenAPI documentation.
Requires an OpenAPI description file.

## Options

| Option | Type | Description |
| --- | --- | --- |
| [codeSamples](/docs/platform/config/openapi/code-samples) | [Code Samples object](/docs/platform/config/openapi/code-samples) | Configure the generated code samples in your API documentation. |
| [corsProxyUrl](/docs/platform/config/openapi/cors-proxy-url) | string | Overrides the CORS proxy URL used by Replay. Default: `/_api/cors/` (built-in CORS proxy URL). |
| [downloadUrls](/docs/platform/config/openapi/download-urls) | [[API description URL object](/docs/platform/config/openapi/download-urls#api-description-url-object)] | List the URLs used to download the API description in JSON or YAML format. |
| [events](/docs/platform/config/openapi/events) | object | Event hooks to get notified about various user events in API docs |
| excludeFromSearch | boolean | Excludes an OpenAPI description file from search results and `llms.txt` when set to `true`. Default: `false`.  You can [apply it to a specific files](#exclude-an-api-from-search), or to [all OpenAPI descriptions](#exclude-all-apis-from-search). |
| feedback | [Feedback object](/docs/platform/config/feedback#options) | Hide or customize the type of or text included in the feedback form that displays at the end of each endpoint. |
| [generatedSamplesMaxDepth](/docs/platform/config/openapi/generated-samples-max-depth) | number | Sets the number of levels to display in generated payload samples. |
| [hideDownloadButtons](/docs/platform/config/openapi/hide-download-buttons) | boolean | Toggle the appearance of a **Download OpenAPI description** section. |
| [hideInfoMetadata](/docs/platform/config/openapi/hide-info-metadata) | boolean | Toggle the appearance of **OpenAPI info metadata** sections. |
| [hidePropertiesPrefix](/docs/platform/config/openapi/hide-properties-prefix) | boolean | Hides the parent name for nested properties. |
| [hideReplay](/docs/platform/config/openapi/hide-replay) | boolean | Hides the Replay (Try it) functionality. |
| [hideSchemaTitles](/docs/platform/config/openapi/hide-schema-titles) | boolean | Hides the schema field title next to the type. |
| [jsonSamplesExpandLevel](/docs/platform/config/openapi/json-samples-expand-level) | number \| string | Sets the default expand level for JSON payload samples. Use `all` to expand all levels. |
| [layout](/docs/platform/config/openapi/layout) | string | Specifies layout options for OpenAPI documentation. Possible values: `three-panel` \| `stacked`. Default: `three-panel`. |
| [maxDisplayedEnumValues](/docs/platform/config/openapi/max-displayed-enum-values) | number | Specifies the number of enum values to display. |
| [navigation](/docs/platform/config/openapi/navigation) | [Navigation object](/docs/platform/config/openapi/navigation#options) | Hides or selects the page actions on OpenAPI reference pages. |
| [onlyRequiredInSamples](/docs/platform/config/openapi/only-required-in-samples) | boolean | Displays only required fields in request samples. |
| [sanitize](/docs/platform/config/openapi/sanitize) | boolean | Sanitize HTML/Markdown to prevent [cross-site scripting (XSS)](https://owasp.org/www-community/attacks/xss/) attacks. |
| [schemaDefinitionsTagName](/docs/platform/config/openapi/schema-definitions-tag-name) | string | Sets a schema definitions tag name that is applied to all schemas and displayed in the sidebar navigation. |
| [schemasExpansionLevel](/docs/platform/config/openapi/schemas-expansion-level) | number \| string | Sets the default expand level for schemas. Use `all` to expand all levels. |
| [showExtensions](/docs/platform/config/openapi/show-extensions) | [string] \| boolean | Displays specification extensions ('x-' fields). If a list is provided, only those specification extensions are displayed. |
| [showSchemaCatalogLinks](/docs/platform/config/openapi/show-schema-catalog-links) | boolean | Displays links to schemas and requests on an OpenAPI page. These links can be used as `$ref` value in other OpenAPI files within the same project. Default: `false`. |
| [sortRequiredPropsFirst](/docs/platform/config/openapi/sort-required-props-first) | boolean | Sorts schema properties to display required properties first. |

## Examples

### Configure multiple APIs

In your config file, the openapi options can be defined in the root-level or per-API.

- Root-level options apply to all API descriptions.
- API-level options apply only to individual descriptions.
- If both are present, then the options are merged, but the _per-API options take precedence_.

The following example shows separate configurations for multiple APIs:

```yaml
logo: images/awesome-logo.svg
openapi:
  hideReplay: true
apis:
  museum@default:
    root: 'openapi/museum.yaml'
    openapi:
      downloadUrls:
        - title: Download OpenApiDescription
          url: 'https://github.com/Redocly/museum-openapi-example/blob/main/openapi.yaml'
      hideReplay: false
      codeSamples:
        languages:
          - lang: 'curl'
            label: 'curl'
      hideRequestPayloadSample: true
  museum@test:
    root: 'openapi/museum-test.yaml'
    openapi:
      hideDownloadButtons: true
      hideReplay: true
      codeSamples:
        languages:
          - lang: 'Node.js'
          - lang: 'go'
rules:
  example-rule-name: error
```

### Exclude an API from search

To exclude a specific API from the search results, locate the API in `redocly.yaml` and under the `openapi` key, set the `excludeFromSearch` option to `true`.

```yaml
apis:
  museum@default:
    root: 'openapi/redocly-museum.yaml'
    openapi:
      excludeFromSearch: true
```

### Exclude all APIs from search

To exclude all APIs from the search results, under the `openapi` key, set the `excludeFromSearch` option to `true`.

```yaml
openapi:
  excludeFromSearch: true
```

## Resources

- **[OpenAPI Specification](https://spec.openapis.org/oas/latest.html)** - Official OpenAPI Specification documentation for understanding API description standards and best practices
- **[Configuration options changes between reference docs 2.x and newest Redoc configuration](/docs/platform/config/openapi/config-migration)** - Migrate from reference docs 2.x to the newest Redoc configuration for updated features and functionality
- **[Configuration options](/docs/platform/config)** - Explore other project configuration options for comprehensive documentation and platform customization
