Skip to main content

Documentation 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 accounts are created by an admin, not through self-registration. Once an admin creates a doctor profile with POST /api/doctors, the doctor can log in and use the API to publish their weekly availability and monitor their appointment bookings. All doctor endpoints require a valid JWT with the doctor role.

Getting a doctor token

A doctor logs in through the same endpoint as any other user:
curl -X POST http://localhost:3000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "sofia.ramirez@clinic.com",
    "password": "your_password"
  }'
Use the returned token as Authorization: Bearer <token> on all doctor requests.

Doctor endpoints

View your profile

GET /api/doctors/me
Authorization: Bearer <token>
Returns the doctor profile associated with the authenticated user account.
curl http://localhost:3000/api/doctors/me \
  -H "Authorization: Bearer <doctor_token>"

Set availability

POST /api/availability
Authorization: Bearer <token>
Content-Type: application/json
Creates an availability block on the doctor’s weekly schedule. day_of_week is an integer (0 = Sunday, 1 = Monday, …, 6 = Saturday). Times are in HH:MM format.
curl -X POST http://localhost:3000/api/availability \
  -H "Authorization: Bearer <doctor_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "day_of_week": 1,
    "start_time": "09:00",
    "end_time": "13:00"
  }'

View your availability

GET /api/availability/me
Authorization: Bearer <token>
Returns all availability blocks for the authenticated doctor.
curl http://localhost:3000/api/availability/me \
  -H "Authorization: Bearer <doctor_token>"

Delete an availability block

DELETE /api/availability/:id
Authorization: Bearer <token>
Removes a specific availability block by its ID.
curl -X DELETE http://localhost:3000/api/availability/42 \
  -H "Authorization: Bearer <doctor_token>"

View your appointments

GET /api/bookings/doctor
Authorization: Bearer <token>
Returns all bookings made with the authenticated doctor, including patient details and appointment times.
curl http://localhost:3000/api/bookings/doctor \
  -H "Authorization: Bearer <doctor_token>"

Access control

All doctor endpoints use authorizeRoles('doctor'). Requests from admin or patient accounts will receive a 403 Forbidden response even if they carry a valid JWT.
Patients can view a doctor’s availability publicly via GET /api/availability/:id without authentication. Only the doctor themselves can create or delete their own availability blocks.

Build docs developers (and LLMs) love