Documents
Upload Medical Document
Upload a document file and attach it to an appointment
POST
Overview
Uploads a document file and attaches it to an existing appointment. The file is stored in secure object storage and a document record is created and linked to the appointment. The uploading doctor is taken from the JWT token. Accepted file types are PDF, PNG, JPEG, JPG and WEBP (application/pdf, image/png, image/jpeg, image/jpg, image/webp).
This endpoint is plan-gated by the
documents.attach_additional feature. Accounts whose plan does not include it receive 403 FEATURE_NOT_AVAILABLE.Authentication
Bearer token for authenticated access. The uploading doctor’s ID is extracted from the JWT token.
Path Parameters
The appointment ID (ObjectId) to attach the document to. The appointment must belong to the authenticated doctor, otherwise a
403 Forbidden is returned.Body Parameters
The request must be sent asmultipart/form-data.
The document file. Allowed types:
application/pdf, image/png, image/jpeg, image/jpg, image/webp.Optional display title for the document. If omitted, the uploaded file’s original filename is used.
Response
Whether the upload was successful
The stored document record
Error message (only present when
success is false)Additional fields may be present on the document object and should be treated as opaque.
Example Request
Example Response
Error Responses
Behavior
- Automatic appointment linking: on success, the appointment record’s
document_idis set to the newly created document. - Upload/save failures are returned as
400with{ "success": false, "error": "Error uploading or saving document" }. - The
Authorizationerrors above also cover revoked sessions, which return401with{ "success": false, "message": "Session ended on this device because you signed in elsewhere.", "code": "SESSION_REVOKED" }.