# Global Dependencies

For some types of applications you might want to add dependencies to the whole application.

Similar to the way you can [add `dependencies` to the _path operation decorators_](/guides/tutorial-user-guide-dependencies-dependencies-in-path-operation-decorators), you can add them to the `FastAPI` application.

In that case, they will be applied to all the _path operations_ in the application:

```python
from typing import Annotated

from fastapi import Depends, FastAPI, Header, HTTPException


async def verify_token(x_token: Annotated[str, Header()]):
    if x_token != "fake-super-secret-token":
        raise HTTPException(status_code=400, detail="X-Token header invalid")


async def verify_key(x_key: Annotated[str, Header()]):
    if x_key != "fake-super-secret-key":
        raise HTTPException(status_code=400, detail="X-Key header invalid")
    return x_key


app = FastAPI(dependencies=[Depends(verify_token), Depends(verify_key)])


@app.get("/items/")
async def read_items():
    return [{"item": "Portal Gun"}, {"item": "Plumbus"}]


@app.get("/users/")
async def read_users():
    return [{"username": "Rick"}, {"username": "Morty"}]
```

And all the ideas in the section about [adding `dependencies` to the _path operation decorators_](/guides/tutorial-user-guide-dependencies-dependencies-in-path-operation-decorators) still apply, but in this case, to all of the _path operations_ in the app.

## Dependencies for groups of _path operations_

Later, when reading about how to structure bigger applications ([Bigger Applications - Multiple Files](/guides/tutorial-user-guide-bigger-applications)), possibly with multiple files, you will learn how to declare a single `dependencies` parameter for a group of _path operations_.

## Related pages

- [Classes as Dependencies](./tutorial-user-guide-dependencies-classes-as-dependencies.md)
- [Sub-dependencies](./tutorial-user-guide-dependencies-sub-dependencies.md)
- [Dependencies in path operation decorators](./tutorial-user-guide-dependencies-dependencies-in-path-operation-decorators.md)
- [Dependencies with yield](./tutorial-user-guide-dependencies-dependencies-with-yield.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
