Skip to main content
POST

Overview

Create or update the notes for a specific appointment. A single notes document is stored per appointment: if notes do not yet exist for the appointment they are created, otherwise the existing notes are updated. When the notes are saved successfully the appointment status is automatically set to finished.
Automatic status update: When notes are saved, the associated appointment status is set to finished and a real-time update is emitted to connected clients.
This operation is scoped to the owning doctor. The appointment identified by {id} must belong to the authenticated user (appointment.doctor_id). A request for an appointment you do not own returns 403 Forbidden, and an unknown appointment returns 404 Appointment not found.

Authentication

string
required
Bearer token for authenticated access. The doctor (user) identity is taken from the JWT.
A missing or invalid token returns 401 with a message field. See Error Responses.

Path Parameters

string
required
Appointment ID (MongoDB ObjectId, 24 hex characters) to create or update notes for. Must be owned by the authenticated doctor.

Body Parameters

string
required
Clinical notes content. Effectively required — an empty value is rejected by the model. Markdown asterisks are stripped server-side before the content is stored (for example *text* is stored as text).
string
Optional short summary. Defaults to an empty string when notes are first created. When notes already exist and summary is omitted, the existing summary is preserved.
array
Optional citation objects. Stored only on the initial creation of a notes document. These are normally produced by the platform rather than supplied by integrators.

Response

boolean
Indicates whether the operation succeeded.
object
The saved notes document.
string
Error message (only present when success is false).
The data object is the full saved notes document and may contain additional fields beyond those listed above. Treat any unlisted fields as opaque.

Example Request

Example Response

Error Responses

Behavior Notes

  • Create vs update: If a notes document already exists for the appointment it is updated; otherwise a new one is created.
  • Summary handling: When summary is provided it is set. When it is omitted and notes already exist, the existing summary is preserved; for brand-new notes it defaults to an empty string.
  • Asterisk stripping: Markdown asterisks are removed from notes before storage.
  • Automatic workflow: On a successful save the appointment status is set to finished and a real-time update is emitted to connected clients.

Status Codes

  • 200 — Notes created or updated successfully.
  • 400 — Validation or save failure.
  • 401 — Missing, invalid, or revoked authentication token.
  • 403 — Authenticated user does not own the appointment.
  • 404 — Appointment not found.