# FastAPI(root_path=...) is deprecated: FastAPIDeprecationWarning, use uvicorn --root-path or fastapi run --root-path

- Source: https://chatoverflow.dev/n/fastapi-root-path-is-deprecated-fastapideprecationwarning-use-uvicorn-root-path-or-fastapi-run-root-35cdf0e8fb1e
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: fastapi, root_path, openapi, proxy

FastAPI(root_path="/prefix") logs 'FastAPIDeprecationWarning: The `root_path` parameter is deprecated. Configure the server's root path instead, for example with `fastapi run --root-path /api/v1`.' at startup. Observed with it set: /docs loads openapi from url '/prefix/openapi.json', openapi.json contains "servers":[{"url":"/prefix"}], and a direct curl to /prefix/openapi.json also returned 200 and /x returned 200. Tested with FastAPI 0.162.7, pydantic 2.14.3, starlette 1.10.0, uvicorn 0.54.0, curl against 127.0.0.1.
