Upload a support document
This guide covers completing the document placeholders on a pre-appointment.
Prerequisites
- A pre-appointment
id(from HIS inbound or a manual create). - Credentials enabled for uploading pre-appointment documents.
- A file to upload: PDF, JPEG or PNG, up to 45 MB.
Step 1 — Upload the file
The request is multipart/form-data with two parts: the binary file and a JSON request_data part.
curl -X POST https://sandbox.osigu.com/pre-attendance-api/v1/checkin/appointments/$ID/documents \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-F 'file=@medical-order.pdf;type=application/pdf' \
-F 'request_data={"support_file_code":"CPF","provider_product_codes":["PROC001"]};type=application/json'
support_file_code— which required document this is (case-insensitive match against the placeholders).provider_product_codes— which charges to complete. Omit or leave empty to complete that support for all charges of the appointment; provide codes to restrict it.
On success you get 201 Created with one array element per completed placeholder. The file is stored once and shared across all placeholders it completes.
Step 2 — List the documents
curl https://sandbox.osigu.com/pre-attendance-api/v1/checkin/appointments/$ID/documents \
-H "Authorization: Bearer $ACCESS_TOKEN"
Returns every enabled document — including still-PENDING placeholders (with a null download URL) — each with a presigned URL and the associated charge. Presigned URLs expire, so re-list to refresh them.
Step 3 — Replace a document
To replace a document that is already received, send the same request again with explicit provider_product_codes (the charge whose document you are replacing):
curl -X POST https://sandbox.osigu.com/pre-attendance-api/v1/checkin/appointments/$ID/documents \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-F 'file=@medical-order-v2.pdf;type=application/pdf' \
-F 'request_data={"support_file_code":"CPF","provider_product_codes":["PROC001"]};type=application/json'
The previous file is overwritten on the same record or, when the support document's keep_support_file_history setting is on (configured by OSIGU), kept as an active record next to the new one; in that case GET .../documents lists both. The 201 returns only the resulting document and the AI validation restarts. You can only replace documents uploaded through the same channel: reception-desk documents from the reception desk, HIS documents from the HIS (403 otherwise). Without explicit provider_product_codes there is nothing to replace and the request fails with 422.
Step 4 — Delete or clear (manual documents only)
-
Delete a manually uploaded document (soft-delete):
curl -X DELETE https://sandbox.osigu.com/pre-attendance-api/v1/checkin/appointments/$ID/documents/$DOC_ID \-H "Authorization: Bearer $ACCESS_TOKEN" -
Clear it back to PENDING (keeps the placeholder, wipes the file):
curl -X POST https://sandbox.osigu.com/pre-attendance-api/v1/checkin/appointments/$ID/documents/$DOC_ID/clear \-H "Authorization: Bearer $ACCESS_TOKEN"
Both return 204 No Content. Neither removes the file from storage (it may be shared). Documents from the HIS cannot be deleted or cleared — those return 403.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
422 on upload | Nothing to complete or replace for the support_file_code + provider_product_codes (no PENDING placeholder and, with explicit codes, no received document), or unsupported MIME type | Check the configured supports for the charge; ensure the file is really PDF/JPEG/PNG |
413 or 500 without a message on upload | File over the platform limit (45 MB) | Split the file |
403 on delete/clear | The document came from the HIS | Only MANUAL documents are mutable |
403 on upload (replace) | The document was uploaded through the other channel | Replace it from the channel that uploaded it |
404 on upload | Appointment not found or not yours | Check the id and that it belongs to your provider |
Next steps
- Support documents for the full model (placeholders, sources, AI validation).
- Support configuration — how required documents are defined per product code.