Endpoint
Authentication
Description
Creates a new doctor record by associating an existing person with a specialty. The person must exist in the system and cannot already be registered as a doctor or user.Request Body
ID of the person to register as a doctor. The person must exist and not already be a doctor or user.
ID of the medical specialty to assign to the doctor
Professional email address for the doctor. Must be unique.
Professional license or medical registration number
Response
Returns the newly created doctor object.Response Fields
Unique identifier for the newly created doctor
ID of the associated person
ID of the assigned specialty
Doctor’s professional email address
Professional license number (null if not provided)
Active status (defaults to true for new doctors)
Example Request
Example Response
Error Responses
400 Bad Request
Missing required fieldsPerson has a user roleInvalid specialty ID
401 Unauthorized
Missing or invalid authentication token
403 Forbidden
User does not have admin role
404 Not Found
Person does not exist
409 Conflict
Person is already registered as a doctorEmail or person is duplicated
500 Internal Server Error
Server error while creating doctor
Business Rules
Important validation rules:
- The person must exist in the
personastable - The person cannot already have a user account (usuario role)
- The person cannot already be registered as a doctor
- The email must be unique across all doctors
- The specialty must exist in the
especialidadestable