# Roles and Ownership: 401 or 403

Signed in isn't the same as allowed, so a require_role dependency lets only the right role through, an ownership check compares a record's owner with the signed-in user's id, and both answer 403 Forbidden, while 401 stays for a request with no valid token.

![Cheat sheet: Roles and Ownership: 401 or 403](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/5739e6bf51ef4d4293c0eb60bbdb9493.webp)

- Category: FastAPI
- Level: Journeyman
- Tags: 401 Unauthorized, 403 Forbidden, Authorization, fastapi, Ownership Check, rest-api, Role-Based Access Control (rest-api)
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/fastapi-auth-roles-and-ownership-cheat-sheet
