Skip to main content

Uploading Files

Add documents with POST /v1/data-engine/batches/{batchId}/documents. Send plain text inline. Upload PDFs, Word files, and anything over 1 MiB separately.

Each request takes up to 100 documents and 10 MiB. It is atomic: if it returns 409 or 422, no document in it was added.

Document Fields​

FieldRequiredDescription
externalReferenceYesYour ID for the document. Unique within the batch, up to 500 characters
mediaTypeYesA supported type. Parameters such as ; charset=utf-8 are ignored
contentInline text onlytext/plain or text/markdown, up to 1 MiB
byteSizeRecommended for filesSize in bytes
checksumSha256Recommended for filesSHA-256 as Base64 or 64 hex characters
filenameNoOriginal file name, up to 512 characters
patientNo{ "externalId": "P-100" }
encounterNo{ "externalId": "V-22", "date": "2026-10-01" }
metadataNoUp to 20 string pairs, 500 characters each. Returned as sent
{
"documents": [
{
"externalReference": "note-8841",
"mediaType": "text/plain",
"content": "Clinical note text",
"patient": { "externalId": "P-100" },
"encounter": { "externalId": "V-22", "date": "2026-10-01" },
"metadata": { "ward": "4B" }
}
]
}

A document with content starts as pending. Without content, it starts as awaiting_upload.

Upload a File​

Declare the document without content, including byteSize and checksumSha256. Then upload the bytes:

curl -s -X PUT \
"https://api.amorphous.health/v1/data-engine/batches/$BATCH_ID/documents/$DOCUMENT_ID/content" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/pdf" \
--data-binary @scan-12.pdf
CheckOn Failure
Body is at most 25 MiB413
Content-Type matches mediaType415
Bytes match checksumSha256409 with checksum_mismatch
Size matches byteSize422 with pointer /byteSize

Uploading the same bytes again returns 200. Different bytes return 409: content cannot change once stored.

Media Types​

Other types return 415.

mediaTypeInline
text/plainYes
text/markdownYes
application/pdfNo
application/mswordNo
application/vnd.openxmlformats-officedocument.wordprocessingml.documentNo
application/rtfNo
application/vnd.oasis.opendocument.textNo

Patient and Encounter​

Patient and encounter details are sent alongside the file, not inside it. They are optional and independent of each other.

FieldEffect
patient.externalIdLinks the document to that patient. Without it, the document is still processed
encounter.externalId, encounter.dateRecorded on the document