Skip to main content

Overview

Retrieve all medical documents uploaded by a specific doctor in MediSync. This endpoint returns a list of all documents that have been uploaded by the specified healthcare provider across all their appointments.
Doctor-Based Retrieval: This endpoint allows healthcare providers to view all documents they have uploaded, providing a comprehensive overview of their document management activity.

Authentication

curl -X GET \
  'https://app.medisync.me/api/documents/doctor/doc_abc123' \
  -H 'Authorization: Bearer YOUR_API_TOKEN'

Path Parameters

id
string
required
The doctor/user ID to retrieve documents for

Response

success
boolean
Whether the request was successful
data
array
Array of documents uploaded by the doctor
error
string
Error message if the request failed

Response Examples

Successful Response with Documents

{
  "success": true,
  "data": [
    {
      "_id": "65f1a2b3c4d5e6f7g8h9i0j1",
      "appointment_id": "65f1a2b3c4d5e6f7g8h9i0j1",
      "document_url": "https://storage.cloud.telekom.de/dokumente/65f1a2b3c4d5e6f7g8h9i0j1_lab_results.pdf",
      "document_key": "65f1a2b3c4d5e6f7g8h9i0j1_lab_results.pdf",
      "doctor_id": "doc_abc123",
      "createdAt": "2024-01-15T14:30:00.000Z",
      "updatedAt": "2024-01-15T14:30:00.000Z"
    },
    {
      "_id": "65f1a2b3c4d5e6f7g8h9i0j2",
      "appointment_id": "65f1a2b3c4d5e6f7g8h9i0j2",
      "document_url": "https://storage.cloud.telekom.de/dokumente/65f1a2b3c4d5e6f7g8h9i0j2_imaging_report.pdf",
      "document_key": "65f1a2b3c4d5e6f7g8h9i0j2_imaging_report.pdf",
      "doctor_id": "doc_abc123",
      "createdAt": "2024-01-15T16:45:00.000Z",
      "updatedAt": "2024-01-15T16:45:00.000Z"
    }
  ]
}

Successful Response with No Documents

{
  "success": true,
  "data": []
}

Error Response

{
  "success": false,
  "error": "Error fetching documents by doctor ID"
}

Business Logic

  1. Doctor-Centric View: Provides healthcare providers with a complete view of all documents they have uploaded.
  2. Cross-Appointment Access: Returns documents from all appointments where the doctor has uploaded files.
  3. Secure Access: Only authorized users can access documents based on their permissions and the doctor ID.
  4. Chronological Order: Documents are typically returned in chronological order by creation date.

Error Handling

  • 400 Bad Request: Invalid doctor ID format or database query error
  • 401 Unauthorized: Invalid or missing authentication token
  • 404 Not Found: Doctor ID does not exist (returns empty array)
  • 500 Internal Server Error: Database connection or query error

Notes

  • Returns an empty array if no documents are found for the doctor
  • Useful for administrative oversight and doctor activity monitoring
  • Document URLs are secure and require proper authentication to access
  • The actual file content is not returned - use the download endpoint to retrieve file data
  • Results may be paginated for doctors with large numbers of documents