Every protected endpoint in Marbes Backend requires a valid credential on each request. There are two authentication modes: standard JWT Bearer tokens for authenticated staff users, and solicitud tokens for public-facing credit application links that are shared with clients. This page explains how to obtain credentials, how to attach them to requests, and what error responses look like.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/scoria02/marbes2021_backend/llms.txt
Use this file to discover all available pages before exploring further.
Standard JWT authentication
Obtain a token
CallPOST /api/auth/login with your identifier and password. The identifier can be an email address, a name (username), or a code — exactly one of these three fields is required.
Login response
Token payload
The token is a signed HS256 JWT. When decoded, its payload contains:| Field | Type | Description |
|---|---|---|
id | string | Internal user ID |
nombre | string | User’s first name |
cedula_rif | string | National ID or tax ID |
email | string | User’s email address |
iat | number | Issued-at timestamp (Unix seconds) |
exp | number | Expiry timestamp (Unix seconds) |
Attach the token to requests
Include the token in theAuthorization header of every protected request using the Bearer scheme:
The
Bearer prefix (with a trailing space) is required. A header like Authorization: eyJhbG... without the scheme prefix will be rejected with a 401.Solicitud token authentication
Some endpoints support a second authentication mode for public credit application links. When a link is generated for a client, it carries a one-time token that can be passed instead of a JWT. This allows unauthenticated clients to submit credit applications without needing a staff account. Endpoints that support this mode accept either a JWT Bearer token or a solicitud token. If both are present, the JWT takes precedence.Pass the solicitud token
Send the token in theX-Solicitud-Token request header:
token.
Solicitud token lifecycle
A solicitud token becomes invalid if any of the following is true:- The token was not found in the database
- The link has already been used (
usado: true) - The link has expired (past its
expira_entimestamp)
SOLICITUD_CREDITO_EXPIRA_HORAS environment variable (for example, 72 = 3 days).
Authentication errors
All authentication failures return HTTP401 with a JSON body. The message field indicates the specific cause:
| Message | Cause |
|---|---|
"Acceso denegado. No se proveyó token." | Authorization header is missing or does not start with Bearer |
"Token inválido: estructura incorrecta." | Token decoded successfully but payload is not a valid object |
"Token inválido o expirado." | Token signature verification failed or the token has expired |
"Credenciales inválidas." | Login attempt failed — wrong password or identifier not found |
"Token de solicitud no encontrado." | The solicitud token does not exist in the database |
"Este link ya fue utilizado." | The solicitud link was already consumed |
"El link ha expirado." | The solicitud link’s expira_en date is in the past |