Skip to main content

Overview

Retrieve all medical documents associated with a specific appointment in MediSync. This endpoint returns a list of documents that have been uploaded and linked to the specified appointment.
Appointment-Based Retrieval: Documents are organized by appointment ID, allowing you to easily access all medical documents related to a specific consultation or medical visit.

Authentication

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

Path Parameters

id
string
required
The appointment ID to retrieve documents for

Response

success
boolean
Whether the request was successful
data
array
Array of documents associated with the appointment
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"
    }
  ]
}

Successful Response with No Documents

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

Error Response

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

Business Logic

  1. Appointment-Centric: Documents are retrieved based on the appointment ID, not individual document IDs.
  2. Multiple Documents: While the upload endpoint currently restricts to one document per appointment, this endpoint returns an array to support potential future expansion.
  3. Secure Access: Only authorized users can access document information for appointments they have permission to view.

Error Handling

  • 400 Bad Request: Invalid appointment ID format or database query error
  • 401 Unauthorized: Invalid or missing authentication token
  • 404 Not Found: Appointment 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 appointment
  • 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
  • Document metadata includes creation and update timestamps for audit purposes