Replace FastAPI's Built-in Swagger UI
FastAPI builds a full OpenAPI document from your route type hints and Pydantic models automatically, then
serves two viewers on top of it out of the box: Swagger UI at /docs and ReDoc at /redoc. If the
generated schema is fine but the viewer isn’t, you don’t need to touch any of that — the document is just
JSON at a fixed URL, and any viewer that can fetch a URL can replace the bundled one.
Disable the built-in docs
Pass docs_url=None and redoc_url=None to the FastAPI constructor. This turns off both bundled
viewers but leaves the underlying schema untouched:
from fastapi import FastAPI
app = FastAPI(docs_url=None, redoc_url=None)
The raw document is still generated and served at /openapi.json by default — that URL is controlled
separately by the openapi_url parameter, which defaults to "/openapi.json" and stays active even with
both viewers disabled.
Mount GetMan at the old docs URL
Add a route at /docs (or wherever you’d like) that returns a small HTML page instead of FastAPI’s
built-in one:
from fastapi.responses import HTMLResponse
@app.get("/docs", include_in_schema=False)
async def custom_docs():
return HTMLResponse("""
<div id="api-docs" style="height: 100vh"></div>
<script src="https://cdn.getman.dev/latest/getman-ui.js"></script>
<script>
GetMan.launch(document.getElementById('api-docs'), { url: '/openapi.json' });
</script>
""")
include_in_schema=False keeps this route itself out of the OpenAPI document it’s rendering — without
it, FastAPI would list /docs as an endpoint of your own API.
If you’ve customized the schema path
Some projects move the document itself, e.g. FastAPI(openapi_url="/api/v1/openapi.json"). If you’ve done
that, update the url passed to GetMan.launch() to match — it just needs to point at wherever your
openapi_url actually resolves.
For the broader feature differences this swap buys you, not just the setup steps, see the Swagger UI alternative comparison. If this is one of several internal services each generating their own docs, see internal API documentation for running the same viewer across all of them.
Try it with your own spec
Paste any OpenAPI or Swagger URL and see it rendered live — no signup, no install.
Open the explorer