Connect your hospital
OpenAPI 3.1 (JSON)Keys and privacy
Create a key per hospital in Integrations. Send it as Authorization: Bearer twk_…. Keys can only send events, are stored as hashes and can be revoked. Every request is limited to 120 per minute per key; batch up to 500 events. Patient identifiers (MRN, FHIR Patient reference) are replaced by a per-hospital pseudonym before anything is applied or stored; names are never needed. Give an id to each event and repeats are reported as duplicates, so retries are safe.
Every response: { "accepted": n, "rejected": n, "duplicates": n, "errors": [...] }. HTTP 200 when anything was applied, 422 when nothing could be.
/api/v1/hl7 text/plainADT A04 (ER registration), A01 (admit to a bed), A02 (transfer), A03 (discharge). One or many messages. Bed from PV1-3 as unit^room^bed (bed id room-bed, e.g. F1-A03-2); sex from PID-8 (used for single-sex room rules); times from EVN-2, Saudi time if no zone.
MSH|^~\&|HIS|ALWAHA|TAWAM|TAWAM|20261005091200||ADT^A01|MSG0001|P|2.5 EVN|A01|20261005091500 PID|1||MRN0042^^^ALWAHA||DOE^JANE||19800101|F PV1|1|I|A^F1-A03^2
/api/v1/fhir application/fhir+jsonA resource or a Bundle. Encounter: arrived/triaged → arrival; in-progress with an active Location → move to that bed; finished/cancelled → discharge. Location (a bed): operationalStatus H or K → needs cleaning, U → clean and free. Each version is its own event (id from resource id + versionId).
/api/v1/ble application/jsonA gateway's scan: readings of beacons per tag. The twin keeps the last 4 scans per tag and locates it with an HMM filter (room-level 99.0% in simulation; real buildings need site calibration). Gateways that go silent for 30 minutes show in Data quality.
{ "gateway": "gw-F1", "readings": [ { "tag": "WC-90", "beacon": "b-F1-A03-1", "rssi": -61, "kind": "wheelchair" } ] }/api/v1/events application/jsonAnything else, in the twin's own format: arrival, triage (esi, isolation), admit_decision (type: medical/surgical/icu), move (bed), discharge, bed_status (dirty/cleaning/free). Optional sex (F/M) and isolation (true) feed the bed rules.
{ "events": [ { "id": "evt-1", "kind": "admit_decision", "patient": "MRN0042", "type": "medical", "at": "2026-10-05T09:20:00+03:00" } ] }Webhooks
Register HTTPS endpoints in Integrations for er.warning (the ER early warning rises to amber or red), task.created and task.done (transport), bed.assigned, and infection.exposure (a patient was moved in a wheelchair that carried an isolation patient). Each POST carries { event, at, data } and a signature:
Tawam-Signature: t=1791157000,v1=<hex HMAC-SHA256(secret, "1791157000." + body)>
// Node: verify
const [t, v1] = header.split(',').map((x) => x.split('=')[1]);
const ok = crypto.createHmac('sha256', secret).update(`${t}.${body}`).digest('hex') === v1 && Math.abs(Date.now() / 1000 - t) < 300;
Only public HTTPS addresses are accepted. Any 2xx counts as delivered; 20 failures in a row switch the hook off (turn it back on with Test).
Sandbox
Create an integration sandbox in Hospital setup: a connected hospital that is not billed, with test keys (twk_test_…), to point your interface engine at before going live.
Try it
The request goes from your browser straight to the API; the key is not stored by this page.