Skip to main content

Overview

Upload a PDF medical document to a specific appointment in MediSync. This endpoint allows healthcare providers to attach medical documents to appointments with secure cloud storage and automatic appointment linking.
PDF Documents Only: Currently, only PDF files are supported for document uploads to ensure consistent formatting and compatibility across the platform.

Authentication

curl -X POST \
  'https://app.medisync.me/api/documents/add/65f1a2b3c4d5e6f7g8h9i0j1?uid=doc_abc123' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -F 'document=@medical_report.pdf'

Path Parameters

id
string
required
The appointment ID to upload the document to

Query Parameters

uid
string
required
The doctor/user ID performing the upload

Request Body

Response

success
boolean
Whether the upload was successful
data
object
The uploaded document information
error
string
Error message if the upload failed

Response Examples

Successful Upload

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

File Already Exists Error

{
  "success": false,
  "error": "Document already exists for this appointment"
}

Invalid File Type Error

{
  "success": false,
  "error": "Only PDF files are allowed"
}

Missing File Error

{
  "success": false,
  "error": "No file uploaded"
}

Business Logic

  1. Single Document Per Appointment: Each appointment can only have one document. If a document already exists for the appointment, the upload will fail.
  2. Automatic Appointment Linking: After successful upload, the appointment record is automatically updated with the document ID.
  3. Secure Storage: Documents are stored in Telekom’s secure cloud storage with proper access controls.
  4. File Naming: Documents are stored with a key format of {appointment_id}_{original_filename}.

Error Handling

  • 400 Bad Request: Invalid file type, missing file, or document already exists
  • 401 Unauthorized: Invalid or missing authentication token
  • 500 Internal Server Error: Storage or database error

Notes

  • Only PDF files are currently supported
  • Maximum file size limit is 500MB
  • Documents are stored securely and can only be accessed by authorized users
  • Each appointment can have only one document - use the update endpoint to replace existing documents