Patient config

v1's config writes addressed by a list of patient ids. A trigger is stored as sent in the patient's settings, where it judges its code; one without logic is rejected and reported. Reads are POSTs here too — a thousand ids do not fit in a query string.

OperationEndpoint
Write one config to many patientsPOST /api/patient/config
Write a different config to each of many patientsPOST /api/patient/config/batch
Read the config status of many patientsPOST /api/patient/config/bulk-status

POST /api/patient/config

Write one config to many patients

Applies the same triggers, flags and metadata to every id named. An id may be the Signals id or the refId.

Unknown ids are reported in misses[] rather than failing the batch. modifiedCount counts patients where a row actually changed; status.triggerWrites gives the row counts behind it. Trigger metadata is MERGED and left untouched when absent.

Send resolvedAt (the instant the configuration was COMPUTED, not sent) to have this push refused rather than applied when the patient already carries a configuration resolved strictly later. Refusal is a silent no-op reported as staleIgnoredCount, never an error. Omitting it applies the push unconditionally.

Requires Basic authentication.

Request body

FieldTypeRequiredDescription
resolvedAtstringnoISO-8601 instant at which this configuration was COMPUTED (not sent). A push carrying one is ignored if the patient already has a configuration resolved strictly later. Optional: a push without it is applied unconditionally, exactly as before.
triggersV1ConfigTriggerSchema[]no
idsstring[]yes
metadataobjectnoStamped onto the Patient rows named by ids, merged not replaced.
alertIfEmptybooleanno
alertIfNotebooleanno
alertInactiveDaysnumberno

Responses

StatusMeaning
200v1's envelope: the ids echoed back and the match and modify counts.
401Missing, malformed or unrecognised Basic credentials.
403Authenticated, but the client's role does not permit this, or it is not attached to the patient.
422The payload failed validation.

Response body

FieldTypeRequiredDescription
idsstring[]yesThe ids the request named, echoed back.
statusV1ConfigResultSchemayes

POST /api/patient/config/batch

Write a different config to each of many patients

The per-patient form, each entry with its own triggers, flags, metadata and resolvedAt. results[] has v1's {id, matched, modified} per entry; staleIgnored and misses are additions.

Requires Basic authentication.

Request body

FieldTypeRequiredDescription
patientsV1BatchConfigEntrySchema[]yes

Responses

StatusMeaning
200Match and modify totals, per-patient results, and the ids that missed.
401Missing, malformed or unrecognised Basic credentials.
403Authenticated, but the client's role does not permit this, or it is not attached to the patient.
422The payload failed validation.

Response body

FieldTypeRequiredDescription
matchednumberyes
modifiednumberyes
staleIgnorednumberyesEntries refused for carrying a configuration resolved before the one already applied, summed across the batch.
resultsobject[]yesPer-patient match and modify counts.
missesstring[]yes
rejectedV1RejectedTriggerSchema[]yesTriggers without logic, per patient, so nothing was stored for them.

POST /api/patient/config/bulk-status

Read the config status of many patients

Each patient's configUpdatedAt and trigger codes, so a caller can confirm a push landed without re-reading every trigger; triggerFingerprints adds what each rule says.

Exactly one row per requested id, in the order asked. An id that resolves to nothing answers refId: null with no codes, as v1 did.

A POST because the id list is the request; it writes nothing.

Requires Basic authentication.

Request body

FieldTypeRequiredDescription
idsstring[]yes

Responses

StatusMeaning
200One status row per requested id, in request order.
401Missing, malformed or unrecognised Basic credentials.
403Authenticated, but the client's role does not permit this, or it is not attached to the patient.
422The payload failed validation.

Response body

An array of:

FieldTypeRequiredDescription
idstringyes
refIdstring | nullyesNull for an id that resolved to no patient.
configUpdatedAtdate-time | nullyesExample: "2026-08-27T09:15:00.000Z".
triggerCodesstring[]yesThe codes the patient's own settings hold a trigger or a band for, and out of bed (103214-3) when they hold its limit.
triggerFingerprintsV1TriggerFingerprintSchema[]yesThe CONTENT behind each code, so a caller can compare configuration instead of only checking that a code is present. Added beside triggerCodes, which keeps its exact old meaning.

Did this page help you?