Skip to main content
Creates a new user with the specified role and credentials.

Endpoint

POST /users

Authentication

This endpoint requires JWT authentication and Admin role.
Authorization: Bearer YOUR_JWT_TOKEN

Request Body

nombre
string
required
Full name of the user
rol
string
required
User role. Must be one of:
  • Admin
  • Psicologo
  • TrabajoSocial
  • Guia
nomUsuario
string
required
Username for login (must be unique)
contrasena
string
required
Password (minimum 6 characters)

Response

id
number
Unique identifier for the user
nombre
string
Full name of the user
rol
string
User role
nomUsuario
string
Username
estatus
boolean
User active status (default: true)
creadoEn
string
Timestamp when user was created

Example Request

curl -X POST http://localhost:3000/users \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "María García",
    "rol": "Psicologo",
    "nomUsuario": "mgarcia",
    "contrasena": "secure123"
  }'

Example Response

{
  "id": 5,
  "nombre": "María García",
  "rol": "Psicologo",
  "nomUsuario": "mgarcia",
  "estatus": true,
  "creadoEn": "2026-03-05T10:30:00.000Z"
}
The password is hashed before storage and will not be returned in the response.
Only users with Admin role can create new users.

Build docs developers (and LLMs) love