Skip to main content
POST
/
professionals
Create Professional
curl --request POST \
  --url https://api.example.com/professionals \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "surname": "<string>",
  "dni": "<string>",
  "birthdate": "<string>",
  "gender": "<string>",
  "address": "<string>",
  "phone": "<string>",
  "email": "<string>",
  "specialityID": 123
}
'
{
  "201": {},
  "400": {},
  "401": {},
  "403": {},
  "500": {},
  "professional": {
    "id": 123,
    "name": "<string>",
    "surname": "<string>",
    "dni": 123,
    "birthdate": "<string>",
    "gender": "<string>",
    "address": "<string>",
    "phone": "<string>",
    "email": "<string>",
    "specialityID": 123,
    "state": "<string>"
  }
}
Creates a new professional in the system.

Authentication & Authorization

Authorization
string
required
Bearer token (JWT) required for authentication.
This endpoint requires admin privileges. Only users with the admin role can create new professionals.

Request Body

name
string
required
Professional’s first name. Cannot be empty.
surname
string
required
Professional’s last name. Cannot be empty.
dni
string
required
Professional’s national identification number (DNI).Validation:
  • Cannot be empty
  • Minimum length: 7 characters
  • Must be unique in the system
birthdate
string
required
Professional’s date of birth. Cannot be empty.Format: ISO 8601 date string (e.g., “1985-03-15”)
gender
string
required
Professional’s gender. Cannot be empty.
address
string
required
Professional’s address. Cannot be empty.
phone
string
required
Professional’s phone number.Validation:
  • Cannot be empty
  • Length: 10 to 20 characters
  • Can only contain numbers, hyphens, spaces, or plus signs
  • Pattern: /^[0-9\s\-\+]*$/
email
string
required
Professional’s email address.Validation:
  • Cannot be empty
  • Must be a valid email format
specialityID
number
required
ID of the professional’s specialty.Validation:
  • Cannot be empty
  • Must reference an existing specialty in the system

Response

professional
object
The newly created professional object.

Status Codes

201
Created
Professional created successfully.
400
Bad Request
Validation error. Check the error message for details about which field failed validation.
401
Unauthorized
Missing or invalid JWT token.
403
Forbidden
User does not have admin privileges.
500
Server Error
Internal server error occurred.

Validation Errors

The API returns detailed validation errors in the following format:
{
  "errors": [
    {
      "msg": "El nombre es obligatorio",
      "param": "name",
      "location": "body"
    }
  ]
}
Common validation errors:
  • “El nombre es obligatorio” - Name is required
  • “El apellido es obligatorio” - Surname is required
  • “El DNI es obligatorio” - DNI is required
  • “DNI no válido” - DNI must be at least 7 characters
  • “El DNI ya está registrado” - DNI already exists in the system
  • “La fecha de nacimiento es obligatoria” - Birthdate is required
  • “El genero es obligatorio” - Gender is required
  • “La dirección es obligatoria” - Address is required
  • “El teléfono es obligatorio” - Phone is required
  • “El teléfono debe tener entre 10 y 20 caracteres” - Phone must be 10-20 characters
  • “El teléfono solo puede contener números, guiones o espacios” - Phone contains invalid characters
  • “El email es obligatorio” - Email is required
  • “El email no es válido” - Email format is invalid
  • “La especialidad es obligatoria” - Specialty ID is required
  • “La especialidad no existe” - Specialty ID does not exist

Example Request

curl -X POST "https://api.clinicavitalis.com/professionals" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Juan",
    "surname": "Pérez",
    "dni": "12345678",
    "birthdate": "1985-03-15",
    "gender": "Masculino",
    "address": "Av. Corrientes 1234, Buenos Aires",
    "phone": "+54 11 1234-5678",
    "email": "juan.perez@clinicavitalis.com",
    "specialityID": 1
  }'

Example Response

{
  "professional": {
    "id": 1,
    "name": "Juan",
    "surname": "Pérez",
    "dni": 12345678,
    "birthdate": "1985-03-15T00:00:00.000Z",
    "gender": "Masculino",
    "address": "Av. Corrientes 1234, Buenos Aires",
    "phone": "+54 11 1234-5678",
    "email": "juan.perez@clinicavitalis.com",
    "specialityID": 1,
    "state": "Activo/a"
  }
}

Build docs developers (and LLMs) love