Quickstart
Ingest your first patient record and query it through a deployed Patient Memory instance.
Quickstart
Before you begin
You need a workspace and an OAuth client ID and secret. If you don't have one yet, follow Provision your First Workspace.
Patient Memory is available as a hosted service. Each workspace gets a dedicated server at:
https://<workspace-id>.w.clinia.cloudReplace <workspace-id> with your workspace identifier throughout this guide.
Authenticate
All API requests require a Bearer token. Exchange your client credentials for one using the OAuth 2.0 client credentials grant:
curl -X POST "https://console.clinia.cloud/api/auth/oauth2/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=<client-id>&client_secret=<client-secret>&resource=https://console.clinia.cloud"{
"access_token": "eyJ...",
"token_type": "Bearer",
"expires_in": 3600
}Pass the access_token as Authorization: Bearer <access-token> on every request. Tokens expire after one hour — cache the token and refresh it before it expires. See Manage Credentials for details.
Ingest patient data
Pick a registry key for the patient (the identifier you'll use in all subsequent calls).
No PHI? Use the synthetic bundle
No patient data on hand? Download the Jeanne Tremblay synthetic FHIR R4 bundle and use it to follow along. See the Synthetic Patient Dataset page for a full portrait of Jeanne and what the dataset contains.
curl -X POST "https://<workspace-id>.w.clinia.cloud/v1/patients/my-patient/ingest/fhir" \
-H "Authorization: Bearer <access-token>" \
-H "Content-Type: application/json" \
-d @fhir-bundle.jsoncurl -X POST "https://<workspace-id>.w.clinia.cloud/v1/patients/my-patient/ingest/cda" \
-H "Authorization: Bearer <access-token>" \
-H "Content-Type: text/plain" \
--data-binary @document.xmlcurl -X POST "https://<workspace-id>.w.clinia.cloud/v1/patients/my-patient/ingest" \
-H "Authorization: Bearer <access-token>" \
-H "Content-Type: application/json" \
-d '{ "fhir": [{ "resourceType": "Bundle", "entry": [...] }], "cda": ["..."] }'Response:
{
"ok": true,
"source": "fhir",
"stats": { "itemsScanned": 42, "entitiesExtracted": 12, "eventsExtracted": 8 },
"warnings": 0,
"patient": { "id": "jeanne-72f-copd", "name": "Jeanne Tremblay" }
}Multiple ingest calls for the same patient registry key accumulate sources and re-run entity resolution each time.
Query patient data
# Browse the virtual file system
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/my-patient/vfs?path=/conditions/active" \
-H "Authorization: Bearer <access-token>"
# Read a condition story
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/my-patient/read?path=/conditions/active/type_2_diabetes_mellitus/_story.md" \
-H "Authorization: Bearer <access-token>"
# Audit entity resolution decisions
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/my-patient/resolution" \
-H "Authorization: Bearer <access-token>"Connect an AI agent via MCP
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
const transport = new SSEClientTransport(new URL("https://<workspace-id>.w.clinia.cloud/mcp"), {
requestInit: { headers: { Authorization: `Bearer <access-token>` } },
});
const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(transport);
// Tools available: browse_patient, read_patient, search_patient, get_patient_infoCheck ingest status
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/my-patient/ingest/status" \
-H "Authorization: Bearer <access-token>"{
"patientId": "jeanne-tremblay",
"ready": true,
"patient": { "id": "jeanne-72f-copd", "name": "Jeanne Tremblay" },
"stats": { "entities": 45, "events": 12, "relationships": 38 },
"warnings": []
}