Skip to main content

Overview

Create or update notes for a specific appointment in MediSync. This endpoint creates new notes if none exist for the appointment, or updates existing notes if they are already present. When notes are successfully saved, the appointment status is automatically updated to “finished”.
Automatic Status Update: When notes are created or updated, the associated appointment status is automatically set to “finished” and a real-time update is emitted to connected clients.

Authentication

curl -X POST \
  'https://api.medisync.com/notes/add/apt_abc123?uid=doc_xyz789' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "notes": "Patient presented with chest pain. Physical examination revealed no acute distress. EKG normal. Plan: Continue monitoring, follow up in 1 week.",
    "summary": "Chest pain evaluation - normal findings, continue monitoring"
  }'

Path Parameters

id
string
required
The appointment ID to create notes for

Query Parameters

uid
string
required
The user ID of the healthcare provider creating the notes

Body Parameters

notes
string
required
The clinical notes content for the appointment
summary
string
Optional summary of the notes. If not provided, defaults to empty string. If notes already exist and summary is not provided in the request, the existing summary is preserved.

Response

success
boolean
Indicates if the operation was successful
data
object
The created or updated notes object
error
string
Error message if the operation failed

Example Response

{
  "success": true,
  "data": {
    "_id": "notes_def456",
    "appointment_id": "apt_abc123",
    "notes": "Patient presented with chest pain. Physical examination revealed no acute distress. EKG normal. Plan: Continue monitoring, follow up in 1 week.",
    "summary": "Chest pain evaluation - normal findings, continue monitoring",
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-15T10:30:00.000Z"
  }
}

Behavior Notes

  • Create vs Update: If notes already exist for the appointment, they will be updated with the new content. If no notes exist, new notes will be created.
  • Summary Handling: If summary is provided in the request, it will be set. If not provided and notes already exist, the existing summary is preserved. For new notes, summary defaults to empty string.
  • Automatic Workflow: When notes are successfully saved, the appointment status is automatically updated to “finished”
  • Real-time Updates: An appointmentUpdated event is emitted to connected WebSocket clients when the appointment status is updated
  • Error Handling: If the appointment is not found after notes are saved, an error is returned but the notes operation is still considered complete

Status Codes

  • 200 - Notes created or updated successfully
  • 400 - Invalid request data or operation failed
  • 404 - Appointment not found (returned if appointment missing after notes are saved)