Klinote API Documentation

Sign in with CIAM and call the API with a Bearer token

📚 API Documentation

▼
READ Overview: one API per client
▶

Every client (clinic group) has its own backend, its own sign-in tenant (Microsoft Entra External ID / CIAM) and its own data. Apps must never hard-code a client's API URL. The only fixed address is the shared client directory, which tells the app which client an email belongs to and returns that client's API base URL and sign-in settings.

NameValue
Directory (fixed)https://altivon-directory-func.azurewebsites.net/api/v1
{apiBaseUrl}Returned by the directory, e.g. https://zealand-func.azurewebsites.net/api/v1
iOS bundle IDaltivon.klinote (redirect URI msauth.altivon.klinote://auth)

Flow

  1. User enters email → POST {directory}/discover
  2. Take apiBaseUrl and ciam from the response (picker if several clients)
  3. User enters password → sign in with MSAL using the ciam values
  4. GET {apiBaseUrl}/clinician/access with the ID token → open the app or show the lock screen
  5. All further calls: {apiBaseUrl}/... with the ID token
  6. Store apiBaseUrl + ciam (Keychain); later launches sign in silently

All paths are case-insensitive.

AUTH Authentication
▶

Apps and portals (signed-in users)

Sign in with MSAL against the client's CIAM tenant (values from /discover) and send the ID token (not an access token) on every call.

MSAL settingValue
Client IDciam.clientId
Authorityhttps://{ciam.domain}/{ciam.tenantId}
Scopesopenid profile email
iOSNative authentication (MSALNativeAuthPublicClientApplication, signIn(username:password:)), redirect msauth.altivon.klinote://auth
HeaderRequiredDescription
AuthorizationYesBearer <idToken>
Content-TypePOST/PUTapplication/json

The clinician's identity comes from the token. Access requires an active license in an active organization; super admins always have unlimited access.

curl "https://zealand-func.azurewebsites.net/api/v1/clinician/access" \ -H "Authorization: Bearer <idToken>"

Sign-in only

CIAM sign-in is the only way to call clinician endpoints. The token's audience must be the client's CIAM app registration, and the signed-in email must hold an active clinician license (super admins excepted). For testing, sign in with a CIAM test account (e.g. a licensed test clinician).

POST {directory}/discover
▶

Finds which client(s) an email belongs to. Anonymous, rate-limited. Returns only public sign-in settings.

curl -X POST "https://altivon-directory-func.azurewebsites.net/api/v1/discover" \ -H "Content-Type: application/json" \ -d '{"email": "anna@clinic.dk"}'

Response

{ "clients": [ { "code": "zealand", "name": "Zealand", "apiBaseUrl": "https://zealand-func.azurewebsites.net/api/v1", "ciam": { "tenantId": "91760b41-8fcc-44af-8f99-7e3a09b88d33", "clientId": "ff06a28e-7e59-456d-af3e-c10f6b58c783", "domain": "91760b41-8fcc-44af-8f99-7e3a09b88d33.ciamlogin.com" } } ] }
ResultMeaning
1 clientContinue to password
SeveralShow organisation picker
Empty list"Your account isn't set up yet. Contact your administrator."
400 / 429Invalid email / too many attempts (wait a minute)
GET {apiBaseUrl}/clinician/access
▶

Call right after sign-in, and again whenever any call returns 403 (license may have been revoked).

ResponseApp behaviour
200 {"access":"granted"}Open the app
403 {"access":"denied","reasonCode":"NO_LICENSE"}Lock screen: no active license, contact your administrator
403 NO_EMAIL / FORBIDDENLock screen: access denied, contact your administrator
401Renew the token silently, otherwise sign in again
GET {apiBaseUrl}/GetClinicianDashboardStats
▶

Aggregated dashboard statistics for the signed-in clinician.

QueryTypeRequiredDescription
fromDateISO 8601NoDefault: 30 days ago
toDateISO 8601NoDefault: now
tzOffsetMinutesintNoClient UTC offset, e.g. 60
GET {apiBaseUrl}/GetClinicianDashboardStats?fromDate=2026-10-18T00:00:00.000Z&toDate=2026-11-17T23:59:59.999Z&tzOffsetMinutes=60
GET {apiBaseUrl}/getallconsultationsforclinician · GetConsultationById · GetPatientConsultations
▶
GET {apiBaseUrl}/getallconsultationsforclinician?fromDate=2026-10-18T00:00:00.000Z&toDate=2026-11-17T23:59:59.999Z&page=1&pageSize=200 → { "consultations": [...], "total": 42, "page": 1, "pageSize": 200 } GET {apiBaseUrl}/GetConsultationById?consultationId=3f2b6c1e-... → { "consultation": { ... } } GET {apiBaseUrl}/GetPatientConsultations?patientId=P-10234 → { "consultations": [...] }
POST {apiBaseUrl}/SaveConsultation · PUT consultations/{id}
▶

Create a consultation. The app generates the id (UUID). A 409 on retry means it was already saved — treat as success.

POST {apiBaseUrl}/SaveConsultation { "id": "3f2b6c1e-...", "patientId": "P-10234", "patientName": "Jane Doe", "consultationType": "gp", "chiefComplaint": "Headache", "completedAt": "2026-11-17T10:15:00Z", "consultationTiming": { "startTime": "2026-11-17T10:00:00Z", "endTime": "2026-11-17T10:15:00Z", "totalDurationSeconds": 900 }, "gpAssessment": { "consultationNotes": "optional typed notes (write-only, stored encrypted)" } }

Update: send the full consultation object; consultationType and completedAt are required.

PUT {apiBaseUrl}/consultations/3f2b6c1e-...

Patient ID

patientId is required and groups all consultations and recordings of one patient. Use the clinic's own patient/record number; for a new patient without one, generate a UUID once and reuse it. Never send a fixed placeholder. Avoid personal ID numbers (e.g. CPR).

POST {apiBaseUrl}/UploadConsultationAudio
▶

Step 1 of a recording: reserves license minutes and returns a short-lived upload URL.

HeaderRequiredDescription
Idempotency-KeyRecommendedNew UUID per attempt (safe retries)
X-Org-IdOnly after 409Organization chosen after ORG_SELECTION_REQUIRED
FieldTypeRequiredDescription
consultationIdstringYesConsultation the recording belongs to
patientIdstringYesSee Patient ID above
fileNamestringNoe.g. recording.m4a
contentTypestringNoAudio MIME type, e.g. audio/mp4, audio/webm
fileSizeBytesnumberNoFile size
durationSecondsnumberNoUsed to reserve minutes (default 10 min)
languagestringNoLocale, e.g. da-DK, en-US, ar-IQ. Default en-US
patientNamestringNoDisplay name
POST {apiBaseUrl}/UploadConsultationAudio Authorization: Bearer <idToken> Idempotency-Key: 6b1e... { "consultationId": "3f2b6c1e-...", "patientId": "P-10234", "fileName": "recording.m4a", "contentType": "audio/mp4", "fileSizeBytes": 1834221, "durationSeconds": 612, "language": "da-DK" } → { "success": true, "recordingId": "9a7c...", "uploadUrl": "https://...blob.core.windows.net/...?sv=...", "blobPath": "...", "expiresInMinutes": 15 }

Step 2: upload the file directly to storage (no Authorization header)

PUT <uploadUrl> x-ms-blob-type: BlockBlob Content-Type: audio/mp4 <audio bytes>
StatusMeaning
402License expired or no minutes left
403No active license
409 ORG_SELECTION_REQUIREDResponse lists organizations; let the user pick, retry with X-Org-Id
POST {apiBaseUrl}/ConfirmAudioUpload · AbortConsultationUpload
▶

Step 3: confirm after the storage upload succeeded.

POST {apiBaseUrl}/ConfirmAudioUpload { "recordingId": "9a7c..." }

If step 2 or 3 fails, cancel to release the reserved minutes:

POST {apiBaseUrl}/AbortConsultationUpload { "recordingId": "9a7c...", "reason": "CLIENT_UPLOAD_FAILED" }
POST {apiBaseUrl}/StartTranscription
▶

Step 4: starts transcription. Then poll the status endpoint.

POST {apiBaseUrl}/StartTranscription { "recordingId": "9a7c..." }
GET {apiBaseUrl}/CheckTranscriptionStatus · GetConsultationRecordings · GetRecordingAudioUrl
▶
GET {apiBaseUrl}/CheckTranscriptionStatus/9a7c... → { "recording": { "status": "Transcribing" | "Completed" | "Failed", "hasTranscript": true, ... } } (transcript text is never returned) (poll every ~5 s while processing) GET {apiBaseUrl}/GetConsultationRecordings/3f2b6c1e-... → { "recordings": [ { ..., "audioDeleted": true } ] } GET {apiBaseUrl}/GetRecordingAudioUrl/9a7c... → { "audioUrl": "https://...blob.core.windows.net/...?sv=..." } (short-lived playback link) → 410 { "reasonCode": "AUDIO_DELETED" } audio is deleted once AI documentation succeeds (kept if it fails, for a retry) → 404 { "reasonCode": "AUDIO_NOT_FOUND" }
POST {apiBaseUrl}/consultations/{id}/document
▶

AI documentation is created automatically, once, after transcription. Transcripts are stored encrypted in the backend and are never returned to apps (no transcribedText / consultationNotes in any response). Audio is deleted once documentation succeeds and kept if it fails.

Call this only when the automatic documentation failed: it re-runs the AI from the stored transcript. No body.

POST {apiBaseUrl}/consultations/3f2b6c1e-.../document → 200 { "success": true, "aiAnalysisResult": "<JSON string>" } → 409 { "reasonCode": "ALREADY_DOCUMENTED" } documentation exists (runs only once) → 409 { "reasonCode": "IN_PROGRESS" } still transcribing / documenting → 422 { "reasonCode": "NO_TRANSCRIPT" } → 502 { "reasonCode": "AI_FAILED" } retry later; audio is kept
POST {apiBaseUrl}/TranslateConsultation
▶
POST {apiBaseUrl}/TranslateConsultation { "consultationId": "3f2b6c1e-...", "targetLanguage": "en" }
FLOW Complete Workflow & Errors
▶
  1. Discover: POST {directory}/discover → apiBaseUrl + ciam
  2. Sign in: MSAL with ciam → ID token
  3. Access: GET /clinician/access
  4. Save consultation: POST /SaveConsultation
  5. Reserve upload: POST /UploadConsultationAudio → uploadUrl
  6. Upload: PUT uploadUrl
  7. Confirm: POST /ConfirmAudioUpload (or /AbortConsultationUpload on failure)
  8. Transcribe: POST /StartTranscription → poll /CheckTranscriptionStatus/{recordingId}
  9. Documentation: created automatically once transcription completes → read it from GetConsultationById (only if it failed: POST /consultations/{id}/document)

Error Handling

StatusMeaning / app behaviour
400Bad request — check required fields
401Token expired/invalid — renew silently, else sign in again
402License expired or no minutes left
403Re-run /clinician/access; show lock screen if denied
404Not found
409ORG_SELECTION_REQUIRED → pick organization, retry with X-Org-Id; on SaveConsultation: already saved
429Rate limited — wait and retry
500Server error