CafeteriaPM authenticates all API requests with JSON Web Tokens (JWT). You obtain a token by posting credentials toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/123048152-JJDS/CafeteriaPM_S203/llms.txt
Use this file to discover all available pages before exploring further.
POST /auth/login. Every subsequent request must carry the token in an Authorization: Bearer <token> header. Tokens are signed with HS256 and expire after 480 minutes (8 hours) by default.
Obtaining a Token
Send your email and password as a JSON body to the login endpoint. Both fields are required.| Field | Type | Description |
|---|---|---|
access_token | string | The signed JWT to include in subsequent requests |
token_type | string | Always "bearer" — use as the scheme prefix in the Authorization header |
user_id | integer | Your numeric user ID in the database |
nombre | string | Your display name |
rol | string | Your assigned role (admin, mesero, caja, or cocina) |
Using the Token
Include the token in theAuthorization header of every protected request using the Bearer scheme.
requests library:
Token Payload
The JWT payload contains three standard claims used by the API:| Claim | Value | Description |
|---|---|---|
sub | User ID as a string | Used to look up the User record on each request |
rol | Role name string | Used by require_roles to authorize endpoint access |
exp | Unix timestamp | Controls when the token expires |
python-jose using the SECRET_KEY and ALGORITHM values from config. The sub claim is resolved to a live database record, so tokens issued to deactivated users are rejected even before expiry.
Token Expiry
Tokens expire after
ACCESS_TOKEN_EXPIRE_MINUTES minutes (default 480 minutes / 8 hours).
There is no refresh token endpoint — simply re-authenticate by calling POST /auth/login again
when your token expires. Requests made with an expired token return
401 Unauthorized with {"detail": "Token inválido o expirado"}.Error Responses
The login and authorization layer returns the following error codes. All error bodies follow the shape{"detail": "..."}.
| HTTP Status | detail | Cause |
|---|---|---|
401 | "Credenciales incorrectas" | Wrong email, wrong password, or the account is inactive |
401 | "Token inválido o expirado" | The JWT is expired, malformed, or has an invalid signature |
401 | "Usuario no encontrado o inactivo" | Token is valid but the user record has been deactivated |
403 | "Acceso denegado. Rol requerido: ..." | Authenticated successfully but the role is not permitted for this endpoint |
Passwords
Passwords are hashed with bcrypt via
passlib before being stored. The plain-text password
is only ever transmitted in the body of the POST /auth/login request — always use HTTPS in
production. Never store or log plain passwords anywhere in your application code.