Skip to main content
PUT

Overview

Uploads a new document file for an appointment. Depending on what is already attached, the endpoint either replaces an existing document or adds a new one:
  • If the appointment has a consent document, that consent document is replaced.
  • Otherwise, if the appointment has exactly one document, that document is replaced.
  • Otherwise (multiple documents and none is a consent document), the new file is simply added.
A new document record with a new _id is created on every call. Accepted file types are PDF, PNG, JPEG, JPG and WEBP, with a maximum file size of 25 MB.
This operation is not atomic. When a document is replaced, the old file is deleted from storage and the database first, and the new file is uploaded afterward. If the new upload fails, the old document is already gone.
This endpoint is plan-gated by the documents.attach_additional feature. Accounts whose plan does not include it receive 403 FEATURE_NOT_AVAILABLE.

Authentication

string
required
Bearer token for authenticated access. The doctor’s ID is extracted from the JWT token.

Path Parameters

string
required
The appointment ID (ObjectId) whose document should be replaced or created. The appointment must belong to the authenticated doctor, otherwise a 403 Forbidden is returned.

Body Parameters

The request must be sent as multipart/form-data.
file
required
The replacement document file. Allowed types: application/pdf, image/png, image/jpeg, image/jpg, image/webp. Maximum size 25 MB — larger files are rejected with 413.
string
Optional display title for the document. If omitted, the uploaded file’s original filename is used.

Response

boolean
Whether the operation was successful
object
The newly stored document record
string
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