Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/tukit/llms.txt

Use this file to discover all available pages before exploring further.

The login endpoint validates the user’s credentials and, on success, issues a JSON Web Token (JWT) signed with the server’s secret key. The token encodes the user’s id, userName, email, roles, and activate arrays and is valid for 365 days. The token is also persisted on the user document in the database so the server can reference the current token. The account must have been verified via the Verify Account endpoint before login is permitted — unverified accounts are rejected with a 403 response regardless of whether the password is correct. POST /api/user/login

Authentication

No authentication required.

Request Body

email
string
required
The registered email address. Lookup is performed with the exact value provided, so casing must match what is stored (all emails are stored lowercase by the registration flow).
password
string
required
The account password in plain text. Compared against the stored bcrypt hash using bcrypt.compare.

Response

200 — Success

msj
string
A welcome message ("Bienvenido!").
status
boolean
Always true on success.
token
string
A signed JWT string. Include this value in the token-access header for all protected endpoints. The token expires after 365 days.
user
object
A subset of the authenticated user’s profile.

Error Responses

StatusCause
403One or more required fields (email, password) are missing from the request body.
403The account exists but has not yet been verified (no login_code_confirmed set or activate value is not "1").
203No user found for the provided email address.
203The provided password does not match the stored hash.
500Unexpected server or database error.
Store the returned token securely (e.g. in memory or a secure HTTP-only cookie). Pass it as the token-access request header on all endpoints that require authentication.

Example

curl -X POST https://your-tukit-api.com/api/user/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "marcos@example.com",
    "password": "SuperSecret123"
  }'
Success response:
{
  "msj": "Bienvenido!",
  "status": true,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0ZjFhMmIzYzRkNWU2ZjdhOGI5YzBkMSIsInVzZXJOYW1lIjoiTWFyY29zRGVzaWducyIsImVtYWlsIjoibWFyY29zQGV4YW1wbGUuY29tIiwicm9sZXMiOlt7Im5hbWUiOiJVc3VhcmlvIiwidmFsdWUiOiIxIn1dLCJhY3RpdmF0ZSI6W3sibmFtZSI6IkFjdGl2YWRvIiwidmFsdWUiOiIxIn1dfQ.SIGNATURE",
  "user": {
    "id": "64f1a2b3c4d5e6f7a8b9c0d1",
    "userName": "MarcosDesigns",
    "email": "marcos@example.com",
    "roles": [{ "name": "Usuario", "value": "1" }],
    "activate": [{ "name": "Activado", "value": "1" }]
  }
}
Error — account not yet verified:
{
  "msj": "Tu cuenta aún no está activa. Por favor, confirma tu cuenta utilizando el código de verificación que te hemos enviado al correo",
  "status": false
}
Error — wrong password:
{
  "msj": "Contraseña incorrecta. Inténtalo nuevamente",
  "status": false
}

Build docs developers (and LLMs) love