Create a new doctor record and optionally link it to an existing user account. Only admins can call this endpoint. The linked user must already exist and must have theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/bentlyy/Clinica/llms.txt
Use this file to discover all available pages before exploring further.
doctor role.
Request
Method:POSTPath:
/api/doctorsAuth required: Yes — admin role
Headers
Bearer <token> — a JWT obtained from POST /api/auth/login with an account that has the admin role.Body
The doctor’s full name.
The doctor’s medical specialty (e.g.,
"Cardiología", "Pediatría").The doctor’s contact email. Must be unique across the
doctors table.The ID of the existing user account to link to this doctor profile. The referenced user must have the
doctor role. This field is required by the current implementation.Response
201 — Created
Returns the full doctor record that was inserted.Unique ID of the new doctor record.
The doctor’s full name.
The doctor’s medical specialty.
The doctor’s contact email.
The ID of the linked user account.
Error responses
| Status | Condition | Error message |
|---|---|---|
400 | Any required field is missing | "Missing required fields" |
400 | user_id does not match any user | "User not found" |
400 | The referenced user does not have the doctor role | "User must have role doctor" |
400 | A doctor profile already exists for this user_id or email | "Doctor already exists for this user or email" |
401 | No token provided or token is invalid | — |
403 | Token is valid but the user does not have the admin role | — |
{ "error": "<message>" }.
Example
cURL
Response
Before calling this endpoint, ensure the target user account exists and has been assigned the
doctor role. A user with any other role (including patient or admin) will be rejected.