Skip to main content

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.

The register endpoint creates a new user account in the system. Before creating the record, the server validates all required fields and checks that the email address is not already in use. Passwords are hashed with bcrypt before storage — never stored in plaintext.

Request

Method: POST
Path: /api/auth/register
Authentication: None required
Content-Type: application/json

Body parameters

name
string
required
A username for the new account. Must not be empty.
email
string
required
A valid email address. Must not already be registered in the system.
password
string
required
The account password. Must not be empty. Stored as a bcrypt hash (10 salt rounds).

Validation rules

The following rules are enforced by the RegisterValidationRules middleware before the request reaches the controller:
  • name — must be present and non-empty.
  • email — must be present, non-empty, and a well-formed email address.
  • password — must be present and non-empty.
If any rule fails, the server returns a 400 response with a structured list of errors before any database operation occurs.

Response

201 — created

user
object
required
The newly created user record. The password field is excluded from the response.
Registration does not return a JWT token. After registering, call POST /api/auth/login with the same credentials to obtain a token.

Examples

curl --request POST \
  --url http://localhost:7780/api/auth/register \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "mariagonzalez",
    "email": "[email protected]",
    "password": "s3cur3P@ss"
  }'

Success response

201
{
  "user": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "nombre": "",
    "apellido": "",
    "email": "[email protected]",
    "cedula_rif": "",
    "telefono": "",
    "cargo": "",
    "departamento": "",
    "estatus": "activo",
    "created_at": "2024-06-01T10:00:00.000Z",
    "updated_at": "2024-06-01T10:00:00.000Z"
  }
}

Error responses

400
{
  "errors": [
    {
      "field": "email",
      "message": "El email es requerida"
    },
    {
      "field": "password",
      "message": "La contraseña es requerida"
    }
  ]
}
409
{
  "message": "El email ya está registrado.",
  "field": "email"
}
500
{
  "message": "Error interno del servidor."
}

Build docs developers (and LLMs) love