Skip to main content
POST

Overview

Regenerate the clinical notes for an appointment from its existing transcription. MediSync generates fresh notes and a summary using the requested template and language, updates the stored notes document, and records the chosen template and language on the appointment. The appointment must already have a transcription; if none exists the request returns 404 Transcription not found.
This operation is scoped to the owning doctor. The appointment identified by {id} must belong to the authenticated user. 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 regenerate notes for. Must be owned by the authenticated doctor and have an existing transcription.

Body Parameters

string
required
Identifier of the template to generate against — the ID of a Template document. Omitting it returns 400. A value that is not a valid template ID returns 500 with Template not found in database.
string
ISO language code for generation (for example de or en). Falls back to the appointment’s stored language when omitted.

Response

boolean
Indicates whether the operation succeeded.
object
The regenerated notes content.
string
Error message (only present when success is false).
Additional fields may be present in the response and should be treated as opaque.

Example Request

Example Response

Error Responses

Behavior Notes

  • Order of checks: The request is validated (400 if notes_template_type is missing), then the appointment is loaded (404 / 403), then its transcription is loaded (404), then notes are generated.
  • Language fallback: When language is omitted, the appointment’s stored language is used.
  • Appointment update: On success the appointment’s stored template and language are updated to match the request.
  • Real-time updates: A real-time note update is emitted to connected clients on success.

Status Codes

  • 200 — Notes regenerated successfully.
  • 400 — Missing notes_template_type.
  • 401 — Missing, invalid, or revoked authentication token.
  • 403 — Authenticated user does not own the appointment.
  • 404 — Appointment or transcription not found.
  • 500 — Generation failure, database update failure, or an invalid template ID.