Skip to main content

Overview

Retrieve the doctor letter for a specific appointment in MediSync. This endpoint returns the generated doctor letter associated with the given appointment ID and doctor ID, or null if no letter has been generated yet.
Appointment-Based Retrieval: Doctor letters are retrieved by appointment ID and doctor ID. If no letter exists for the specified appointment and doctor combination, the response will be successful with null data.

Authentication

curl -X GET \
  'https://api.medisync.com/doctor-letters/apt_abc123?uid=doc_xyz789' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN'

Path Parameters

appointment_id
string
required
The appointment ID to retrieve the doctor letter for

Query Parameters

uid
string
required
The doctor ID (user ID) of the healthcare provider who generated the letter

Response

success
boolean
Indicates if the operation was successful
data
object
The doctor letter object or null if no letter exists
error
string
Error message if the operation failed

Example Response

{
  "success": true,
  "data": {
    "_id": "letter_def456",
    "appointment_id": "apt_abc123",
    "patient_id": "pat_ghi789",
    "doctor_id": "doc_xyz789",
    "status": "generated",
    "markdown_content": "# Medical Referral Letter\n\n**Date:** 2024-01-15\n\n**To:** Dr. Sarah Johnson, Cardiology Specialist\n**From:** Dr. Michael Chen, Internal Medicine\n\n**Re:** John Smith (DOB: 1975-08-15)\n\n## Clinical Summary\n\nI am referring Mr. Smith for cardiology evaluation following his recent presentation with chest pain...\n\n## Diagnosis\n- Atypical chest pain (ICD-10: R07.89)\n\n## Current Medications\n- Lisinopril 20mg daily\n\n## Recommendation\nPlease evaluate for possible cardiac etiology and provide treatment recommendations.\n\nThank you for your consultation.\n\nDr. Michael Chen, MD",
    "generation_inputs": {
      "current_date": "2024-01-15",
      "patient_name": "John Smith",
      "date_of_birth": "1975-08-15",
      "appointment_notes": "Patient presented with chest pain...",
      "diagnosis": "Atypical chest pain",
      "icd_10_codes": ["R07.89"],
      "recipient_doctor": "Dr. Sarah Johnson, Cardiology Specialist",
      "referring_doctor": "Dr. Michael Chen, Internal Medicine",
      "language": "en"
    },
    "error": null,
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-15T10:32:00.000Z"
  }
}

Behavior Notes

  • Appointment and Doctor Specific: The letter lookup is performed using both the appointment ID and doctor ID to ensure proper ownership
  • Null Response for Missing Letters: If no letter exists for the specified appointment and doctor, the response is successful with data set to null
  • Status Indication: The status field indicates the current state of the letter (pending, generated, failed, editing)
  • Complete Letter Data: When a letter exists, all generation inputs and metadata are included in the response

Status Codes

  • 200 - Request processed successfully (including when no letter exists)
  • 400 - Invalid request or database error