get_redoc_html
Generate and return the HTML response that loads ReDoc for the alternative API docs (normally served at /redoc). You would only call this function yourself if you needed to override some parts, for example the URLs to use to load ReDoc's JavaScript and CSS.
def get_redoc_html(
openapi_url: str,
title: str,
redoc_js_url: str = https://cdn.jsdelivr.net/npm/redoc@2/bundles/redoc.standalone.js,
redoc_favicon_url: str = https://fastapi.tiangolo.com/img/favicon.png,
with_google_fonts: bool = True
) - > HTMLResponse
Generate and return the HTML response that loads ReDoc for the alternative API docs (normally served at /redoc). You would only call this function yourself if you needed to override some parts, for example the URLs to use to load ReDoc's JavaScript and CSS. Read more about it in the FastAPI docs for Custom Docs UI Static Assets (Self-Hosting).
Parameters
| Name | Type | Description |
|---|---|---|
| openapi_url | str | The OpenAPI URL that ReDoc should load and use. This is normally done automatically by FastAPI using the default URL /openapi.json. Read more about it in the FastAPI docs for Conditional OpenAPI |
| title | str | The HTML < title > content, normally shown in the browser tab. Read more about it in the FastAPI docs for Custom Docs UI Static Assets |
| redoc_js_url | str = https://cdn.jsdelivr.net/npm/redoc@2/bundles/redoc.standalone.js | The URL to use to load the ReDoc JavaScript. It is normally set to a CDN URL. Read more about it in the FastAPI docs for Custom Docs UI Static Assets |
| redoc_favicon_url | str = https://fastapi.tiangolo.com/img/favicon.png | The URL of the favicon to use. It is normally shown in the browser tab. |
| with_google_fonts | bool = True | Load and use Google Fonts. |
Returns
| Type | Description |
|---|---|
HTMLResponse | The HTML response that loads ReDoc. |