FastAPI · Concept
Dependency injection
FastAPI dependencies let a path operation declare reusable logic it needs. FastAPI runs the dependency, reads its inputs, and injects its result into the operation.
Last updated
Syntax
Annotated[Type, Depends(callable)]In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
DependsSecuritySub-dependenciesClasses as DependenciesDependencies in path operation decoratorsGlobal DependenciesDependencies with yield