FastAPI · Concept
Path operations
Use APIRouter to keep related FastAPI path operations in separate modules. Add shared prefixes, tags, dependencies, and responses, then include the router in the main application.
Last updated
Syntax
router = APIRouter(prefix="/items", tags=["items"], dependencies=[Depends(get_token_header)], responses={404: {"description": "Not found"}})
app.include_router(router)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
FastAPIAPIRouter.include_router()DependsPath operationsAutomatic API docs