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.
Read more about it in the
[FastAPI docs for Custom Docs UI Static Assets (Self-Hosting)](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/).
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.
Parameters
| Name | Type | Description |
|---|---|---|
| openapi_url | str | The OpenAPI URL that ReDoc should load and use to generate the documentation. |
| title | str | The HTML < title > content, normally shown in the browser tab. |
| redoc_js_url | str = https://cdn.jsdelivr.net/npm/redoc@2/bundles/redoc.standalone.js | The URL to use to load the ReDoc JavaScript bundle, typically a CDN link. |
| redoc_favicon_url | str = https://fastapi.tiangolo.com/img/favicon.png | The URL of the favicon to use in the browser tab for the documentation page. |
| with_google_fonts | bool = True | Controls whether to load and use Google Fonts (Montserrat and Roboto) in the UI. |
Returns
| Type | Description |
|---|---|
HTMLResponse | The complete HTML document as a response object, configured to initialize the ReDoc documentation UI. |