Avycenna

Integrations

API keys and webhooks for your own systems.

API keys

Under Integrations → API keys, owners and admins create keys for systems such as an EHR sync. The key is shown once; store it securely. Revoking a key stops it immediately. See Authentication.

Webhooks

Add an HTTPS endpoint and choose events:

EventWhen
grant.createdYou invited a patient
grant.acceptedThe patient accepted
grant.revokedSharing ended, by either side

Each delivery is a POST with a JSON body {"event": "...", "data": {...}} carrying IDs and sharing details, not health measurements. Verify it with the X-Avycenna-Signature header, sha256= followed by the hex HMAC-SHA256 of the raw body using the signing secret shown when you created the webhook. X-Avycenna-Event repeats the event name.

import hmac, hashlib

def is_valid(body: bytes, header: str, secret: str) -> bool:
    expected = "sha256=" + hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, header)

ECGs from patients' devices

Patients connect their own devices: Fitbit and Pixel Watch (Google Health API), Withings, Apple Watch, Polar H10, or imported FHIR/CSV files from any ECG device. Every recording shows its classifier — Fitbit ECG app, Withings ECG, Apple ECG, Kardia AI — with the device model; raw-only devices (Polar) show Not classified. Fitbit irregular rhythm notifications appear as their own events.

Your systems can send ECGs for a patient with a write_own key the patient created: POST /cardiac-events/ecg/fhir takes FHIR R4 Observations with valueSampledData (lead I preferred).

With a heart_data grant, the waveform endpoint returns the samples in µV. Add ?raw=true for the device's original integers (raw_samples; millivolts = sample ÷ raw_units_per_mv) for export or your own analysis:

curl "https://api.avycenna.com/api/v1/clinic/patients/$PATIENT_ID/ecg/$EVENT_ID?raw=true" \
  -H "Authorization: Bearer $AVY_API_KEY"

Every read is written to the patient's access log, as with all clinical data.

On this page