Sessions
Create session
DeprecatedOpens a new query session scoped to a patient. Sessions track interaction context across multiple MCP tool calls within a single agent run.
Deprecated: a session no longer needs opening. Writing under a sessionId of your choosing — appending messages, a tool call's session_id, or POST …/ingestions/sessions — creates it, and the import route generates one when a transcript declares none.
Usage
import { ContextEngineClient } from "@clinia/context-engine-js";
// Initialize the client
const client = new ContextEngineClient({
baseUrl: process.env.CLINIA_WORKSPACE,
auth: {
clientId: process.env.CLINIA_CLIENT_ID,
clientSecret: process.env.CLINIA_CLIENT_SECRET,
},
});
// Call the API
const { data, error } = await client.sessions.createSession("<patient-id>");
// Print the response
console.log(data ?? error);The environment variables are set in Install and authenticate, for JavaScript or Python.
API reference
POST /v1/patients/{patientId}/sessions documents the parameters, the request body and the responses.