Skip to main content
Base URL: http://localhost:3001/api/v1 All successful responses follow the envelope:
{ "success": true, "message": "...", "data": { ... } }
Errors return:
{ "success": false, "message": "...", "errors": [...] }

POST /register

Create a new user account. No token is issued on registration.
No authentication required.
Request body
nombre
string
required
Full name of the user.
email
string
required
Email address. Must be unique.
password
string
required
Plain-text password. Hashed before storage.
Example request
curl -X POST http://localhost:3001/api/v1/register \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Ada Lovelace",
    "email": "[email protected]",
    "password": "Secure123"
  }'
Example response201 Created
{
  "success": true,
  "message": "User registered successfully.",
  "data": {
    "id_usuario": 42,
    "nombre": "Ada Lovelace",
    "email": "[email protected]",
    "rol": 1
  }
}

POST /login

Authenticate with email and password. Returns a JWT access token.
No authentication required.
Request body
email
string
required
Registered email address.
password
string
required
Account password.
Example request
curl -X POST http://localhost:3001/api/v1/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "Secure123"
  }'
Example response200 OK
{
  "success": true,
  "message": "Login successful.",
  "data": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "usuario": {
      "id_usuario": 42,
      "nombre": "Ada Lovelace",
      "email": "[email protected]",
      "rol": 1
    }
  }
}
Use the returned accessToken as a Bearer token in the Authorization header for all authenticated endpoints:
Authorization: Bearer <accessToken>

Build docs developers (and LLMs) love