Last updated



The build-docs command builds Redoc into an HTML file.


redocly build-docs <api>
redocly build-docs <api> --output=custom.html
redocly build-docs <api> --theme.openapi.disableSearch
redocly build-docs <api> --template custom.hbs
redocly build-docs <api> -t custom.hbs --templateOptions.metaDescription "Page meta description"


apistringPath to the API description filename or alias that you want to generate the build for. Refer to the API examples for more information.
--configstringSpecifies path to the configuration file.
--disableGoogleFontbooleanDisables Google fonts. The default value is false.
--helpbooleanShows help.
--lint-configstringSpecify the severity level for the configuration file. Possible values: warn, error, off. Default value is warn
--output, -ostringSets the path and name of the output file. The default value is redoc-static.html.
--template, -tstringUses custom Handlebars templates to render your OpenAPI description.
--templateOptionsstringAdds template options you want to pass to your custom Handlebars template. To add options, use dot notation.
--theme.openapistringCustomizes your output with Redoc functionality options or Redoc theming options.
--titlestringSets the page title.
--versionbooleanShows version number.


API examples

The command accepts an API positional argument as either a file (no configuration file is required) or an alias (requires a configuration file).

API path to file example

redocly build-docs openapi.yaml

In this case, the build-docs command builds the API at the path provided. The configuration file is ignored.

API alias example

Instead of a full path, you can use an API name from the apis object of your Redocly configuration file.

redocly build-docs games@v1
    root: ./openapi/api-description.json

The build-docs command uses any additional configurations provided in the file.

Custom configuration file

By default, the CLI tool looks for the Redocly configuration file in the current working directory. Use the optional --config argument to provide an alternative path to a configuration file.

redocly build-docs --config=./another/directory/config.yaml

theme.openapi example

Build docs with hidden search box:

redocly build-docs openapi.yaml --theme.openapi.disableSearch

templateOptions example

Build docs using a custom Handlebars template and add custom templateOptions:

redocly build-docs ./openapi/api.yaml -t custom.hbs --templateOptions.metaDescription "Page meta description"

Sample Handlebars template:

    <meta charset='utf8' />
    <!-- needed for adaptive design -->
    <meta description='{{{templateOptions.metaDescription}}}' />
    <meta name='viewport' content='width=device-width, initial-scale=1' />
      body { padding: 0; margin: 0; }
    {{#unless disableGoogleFont}}<link