Skip to main content
Every records method needs two IDs:
  • bid — your business ID, provided by Eka Care when your account is set up.
  • patientId — the OID of the logged-in user whose records you are working with.

Linked profiles

patientId is the primary OID — the profile that owns writes. Add, edit and delete always use it (sent as the X-Pt-Id header). To also surface records and cases belonging to other profiles (e.g. dependents or family members), pass linkedPatientIds. Read, list and group methods then return the union across [patientId, ...linkedPatientIds], and the background sync fans out one fetch per OID. Omit linkedPatientIds for single-profile behavior — nothing changes.
Supported on listDocuments, listLocalDocuments, groupDocuments, getAllTags, listCases and listLocalCases. Writes (addDocument, editDocument, deleteDocument, createCase, …) always use the primary patientId.

List Documents

listDocuments is cache-first: it gives you local data instantly, then updates it from the server. What happens when you call it:
  1. Local read — the SDK reads the records already stored in IndexedDB.
  2. Instant callback — if you passed onStale, those local records are handed to you right away, so your UI can render without waiting for the network.
  3. Server fetch — the SDK then asks the server only for records that changed since the last sync (not the whole list again) and saves them into IndexedDB. Anyone subscribed to documents:changed gets notified.
  4. Final result — the await completes with the full, up-to-date list. If there is no internet, you still get the local list.
If you don’t pass onStale, there is no early delivery — the call waits for the server fetch to complete and then returns the complete list in one go.
ListDocumentsFilter fields:

The document object

Each item returned by listDocuments / listLocalDocuments is a DocumentItem. The most commonly used fields:

Group Documents

groupDocuments organises the document list into sections, ready to render as a sectioned UI (like a list with headers). Instead of one flat array, you get an array of groups — each with a key, a display label, and the records that fall under it. You can group two ways:
  • By document type — one group per type code: all lab reports together, all prescriptions together, and so on.
  • By date — one group per day, month, or year (e.g. “May 2025”), based on either the document date or the upload date.
Reads from the local DB — no network call.
GroupDocumentsOptions:

Upload a Document

Offline: record + blob are saved to IndexedDB as upload_failure and auto-retried on the next sdk.sync().
File constraints:

Download a Document

Cache-first — returns blobs from IndexedDB if previously fetched, otherwise downloads from S3 and caches.

Get Smart Report

Cache-first — returns the AI-extracted smart report from IndexedDB if available, otherwise fetches from the API.
getParameterTrend returns every logged reading for a single vital or lab parameter (e.g. Hemoglobin) across all of a patient’s reports, so you can plot a trend graph. The parameterId comes from a smart report item’s eka_id (or vital_id).
This is network-only — it hits the vault host and is not cached. Scope it to the profile that owns the vital (the document’s patient_id).
ParameterTrendResponse fields:

Describe a Document

Returns the full details of a document. Cache-first — served from IndexedDB if the document’s files were previously fetched, otherwise fetched from the API.
DescribeDocumentResponse fields (all optional):

Edit a Document

Local-first — patches the DB immediately, syncs to the server in the background.

Delete a Document

Soft-deletes locally (hidden immediately), hard-deletes after the server confirms. Also removes the document from any linked cases in the local DB.

Tags

Tags are set on a document via editDocument (data.tags — see Edit a Document). Two read helpers query them from the local DB — no network call:
getAllTags also accepts linkedPatientIds to span linked profiles.