Skip to main content
Cases act as folders for records. A record can belong to multiple cases. Every case 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 cases you are working with.

List Cases

listCases is cache-first: fires onStale immediately with IndexedDB data, then delta-syncs with the server and resolves the promise with fresh results.
To list the documents inside a case:

Create a Case

Offline: the case is saved locally (isRemoteCreated: false) and created on the server on reconnect.

Update a Case

Delete a Case

Deletes the case only — the records inside it are not deleted. They just lose the link to this case (the case ID is removed from each record’s caseIDs) and remain available in the record list.

Assigning Records to Cases

The case–record link lives on the document, not the case — every record carries a caseIDs: string[] array, and there is no case-side “add documents” method. Both directions are handled through the record APIs.

Assign at upload time

Pass cases in the batch item of addDocument:

Assign / unassign an existing document

Use editDocument with data.cases. This is local-first — the DB is patched immediately and synced to the server in the background.
data.cases replaces the document’s full case list. To add a case without dropping existing links, read the record’s current caseIDs and append.

Assign multiple documents to a case

There is no case.addDocuments() — loop editDocument over the documents:

Reading the relationship

Deletion side effects are handled automatically: deleteCase strips that case ID from all linked records’ caseIDs, and deleteDocument removes the document from any linked cases.