Skip to content

FastAPI

...

Common Fixes

...

Fix: "Failed to load API Definition. Not found /api/v1/openapi.json"

When running behind a proxy (and in some other circumstances) you will get an error when trying to load the /docs endpoint. The error will say "Failed to load API definition. Fetch error Not Found /api/v1/openapi.json":

openapi docs route error

To fix this, simply modify your app = FastAPI() line, adding `openapi_url="/docs/openapi":

fastapi main.py
1
2
3
4
...

# app = FastAPI(openapi_url="/docs/openapi")
app = FastAPI(openapi_url="/docs/openapi")