Pattern

Parameterized Dependency via Closure

parameterized-dependency-closure

A recurring FastAPI shape where request-time parameters (e.g., auth tokens) can’t be passed directly into Depends/dependencies, so you return a callable (closure/factory) that captures arguments and is used as the dependency.