Ingest Unstructured Documents
Register PDFs, images, and other files by metadata so they appear in the patient's source list and VFS.
Where to start
Patient Memory does not extract clinical entities from PDF or image content directly. Instead, you register a document by its metadata (name and MIME type). The document appears in the patient's source list and under /sources/ in the VFS, where an agent can discover it and decide what to do with it.
Make the request
curl -X POST "https://api.<workspace-id>.clinia.cloud/patients/{patientId}/ingest/document" \
-H "X-Clinia-API-Key: <clinia-api-key>" \
-H "Content-Type: application/json" \
-d '{ "name": "discharge-summary.pdf", "mimeType": "application/pdf" }'A successful response:
{
"ok": true,
"source": "document",
"stats": { "itemsScanned": 1, "entitiesExtracted": 0, "eventsExtracted": 0 },
"warnings": 0
}Request details
| Field | Required | Description |
|---|---|---|
name | Yes | File name including extension. Used to generate the VFS slug under /sources/. |
mimeType | No | MIME type hint, e.g. application/pdf, image/jpeg. Stored as document metadata. |
Error responses
| Status | Cause |
|---|---|
400 | Request body is not valid JSON or is missing the required name field |
Check ingest status
Each ingest call runs entity resolution synchronously, so data is queryable immediately on return. Use the status endpoint to confirm the document has been registered and is visible in the VFS:
curl "https://api.<workspace-id>.clinia.cloud/patients/{patientId}/ingest/status" \
-H "X-Clinia-API-Key: <clinia-api-key>"{
"ready": true,
"sources": [
{ "label": "discharge-summary.pdf", "stats": { "itemsScanned": 1, "entitiesExtracted": 0, "eventsExtracted": 0 } }
],
"patient": null,
"loadStats": { "entitiesExtracted": 0, "eventsExtracted": 0, "relationshipsExtracted": 0 },
"loadMs": 12
}ready: true means the document has been registered and is browsable at /sources/ in the VFS. Document registration does not extract clinical entities, so warnings is always empty.
To verify the document appears, browse the sources directory:
curl "https://api.<workspace-id>.clinia.cloud/patients/{patientId}/vfs?path=/sources" \
-H "X-Clinia-API-Key: <clinia-api-key>"Batch ingest
Use the batch endpoint to submit multiple source types in a single call. Entity resolution runs once over all sources rather than once per source call:
curl -X POST "https://api.<workspace-id>.clinia.cloud/patients/{patientId}/ingest" \
-H "X-Clinia-API-Key: <clinia-api-key>" \
-H "Content-Type: application/json" \
-d '{ "documents": [{ "name": "discharge-summary.pdf", "mimeType": "application/pdf" }] }'The batch body accepts any combination of fhir, cda, and documents fields. See the REST API reference for the full request shape.