Manage a Session
Record a conversation turn by turn under a session id, follow its ingestion, and read back what was extracted.
This walks through the interactive session lifecycle: record conversation turns under a session ID of your choosing as they happen, follow the ingestion each one queues, then confirm what landed in the patient's record.
See Sessions for the underlying concepts, and How Interactions Become Memory for what a memory is.
Choose a session id
Pick a session ID you control — for example, one from your own chat infrastructure. There is no call to open the session: its first write does, and every later write under the same ID adds to it. The patient must already exist, and the ID has to fit the character set for identifiers you assign.
Record each turn
After each turn, send the conversation so far under the session ID. The first call creates the session. Only user and assistant roles are accepted.
curl -X POST "https://<workspace-id>.w.clinia.cloud/v1/patients/{patientId}/ingestions/sessions" \
-H "Authorization: Bearer <access-token>" \
-H "Content-Type: application/json" \
-d '{
"sessions": [
{
"sessionId": "session-456",
"messages": [
{ "role": "user", "content": "I stopped taking the Empagliflozin a few weeks ago, it was upsetting my stomach." },
{ "role": "assistant", "content": "Thanks for letting me know, I will flag that for your care team." }
]
}
]
}'The call answers 202 with an ingestion receipt. Memories are formed from the new turns as that ingestion is processed: there is no separate step to trigger it.
Resend the whole conversation each time, with the new turns at the end. Turns already stored are recognised and not stored again, so only the new ones count toward staged.messages. Resending the whole conversation also keeps a turn that repeats an earlier one, such as a second "yes", from being mistaken for it. See Learn Memories from a Transcript for the full rules.
Follow the ingestion
Poll the receipt's ingestionId until status is succeeded, partial or failed:
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/{patientId}/ingestions/{ingestionId}" \
-H "Authorization: Bearer <access-token>"You only need to poll when your application has to read the memories straight away. Otherwise they appear on their own.
Read what the session produced
Once the ingestion settles, list the session's memories and follow each one to the facts it speaks to, as described in Read Memories and Their Links to Facts.