Authorization header of every request to a protected endpoint. The gateway validates the token before forwarding traffic to any downstream service.
Auth flow
Register a new account
Send your email and password to create an account. Registration is a one-time step.Endpoint: A successful response returns HTTP
POST /api/auth/registerThe email address that will identify this account. Must be unique across all users.
The account password. Stored as a bcrypt hash; never returned by the API.
200 with the plain-text body:Log in to obtain a token
Exchange your credentials for a JWT token. The response body is the raw token string—no JSON wrapper.Endpoint: The response is the JWT token as a plain string:
POST /api/auth/loginThe email address used during registration.
The account password.
The token payload contains the user’s email as the subject (
sub) and their role in the role claim. The gateway injects the email as an X-User-Email header when forwarding authenticated requests downstream.Attach the token to API requests
Pass the token in the The gateway strips and validates the token, then forwards the request with the
Authorization header using the Bearer scheme. Every request to /api/inventario/**, /api/pedidos/**, or /api/envios/** requires this header.X-User-Email header populated.Token lifetime
Tokens are valid for 24 hours (86,400,000 ms) from the time of issue. After expiry, repeat step 2 to obtain a new token. There is no refresh endpoint; a full login is required.Error responses
| Status | Cause |
|---|---|
401 Unauthorized — "Token requerido" | The Authorization header is absent or does not start with Bearer . |
401 Unauthorized — "Token inválido" | The token signature is invalid, the token is expired, or the payload is malformed. |