Sign in with CIAM and call the API with a Bearer token
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.
| Name | Value |
|---|---|
| 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 ID | altivon.klinote (redirect URI msauth.altivon.klinote://auth) |
POST {directory}/discoverapiBaseUrl and ciam from the response (picker if several clients)ciam valuesGET {apiBaseUrl}/clinician/access with the ID token → open the app or show the lock screen{apiBaseUrl}/... with the ID tokenapiBaseUrl + ciam (Keychain); later launches sign in silentlyAll paths are case-insensitive.
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 setting | Value |
|---|---|
| Client ID | ciam.clientId |
| Authority | https://{ciam.domain}/{ciam.tenantId} |
| Scopes | openid profile email |
| iOS | Native authentication (MSALNativeAuthPublicClientApplication, signIn(username:password:)), redirect msauth.altivon.klinote://auth |
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer <idToken> |
| Content-Type | POST/PUT | application/json |
The clinician's identity comes from the token. Access requires an active license in an active organization; super admins always have unlimited access.
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).
Finds which client(s) an email belongs to. Anonymous, rate-limited. Returns only public sign-in settings.
| Result | Meaning |
|---|---|
| 1 client | Continue to password |
| Several | Show organisation picker |
| Empty list | "Your account isn't set up yet. Contact your administrator." |
| 400 / 429 | Invalid email / too many attempts (wait a minute) |
Call right after sign-in, and again whenever any call returns 403 (license may have been revoked).
| Response | App behaviour |
|---|---|
200 {"access":"granted"} | Open the app |
403 {"access":"denied","reasonCode":"NO_LICENSE"} | Lock screen: no active license, contact your administrator |
403 NO_EMAIL / FORBIDDEN | Lock screen: access denied, contact your administrator |
| 401 | Renew the token silently, otherwise sign in again |
Aggregated dashboard statistics for the signed-in clinician.
| Query | Type | Required | Description |
|---|---|---|---|
| fromDate | ISO 8601 | No | Default: 30 days ago |
| toDate | ISO 8601 | No | Default: now |
| tzOffsetMinutes | int | No | Client UTC offset, e.g. 60 |
Create a consultation. The app generates the id (UUID). A 409 on retry means it was already saved — treat as success.
Update: send the full consultation object; consultationType and completedAt are required.
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).
Step 1 of a recording: reserves license minutes and returns a short-lived upload URL.
| Header | Required | Description |
|---|---|---|
| Idempotency-Key | Recommended | New UUID per attempt (safe retries) |
| X-Org-Id | Only after 409 | Organization chosen after ORG_SELECTION_REQUIRED |
| Field | Type | Required | Description |
|---|---|---|---|
| consultationId | string | Yes | Consultation the recording belongs to |
| patientId | string | Yes | See Patient ID above |
| fileName | string | No | e.g. recording.m4a |
| contentType | string | No | Audio MIME type, e.g. audio/mp4, audio/webm |
| fileSizeBytes | number | No | File size |
| durationSeconds | number | No | Used to reserve minutes (default 10 min) |
| language | string | No | Locale, e.g. da-DK, en-US, ar-IQ. Default en-US |
| patientName | string | No | Display name |
| Status | Meaning |
|---|---|
| 402 | License expired or no minutes left |
| 403 | No active license |
409 ORG_SELECTION_REQUIRED | Response lists organizations; let the user pick, retry with X-Org-Id |
Step 3: confirm after the storage upload succeeded.
If step 2 or 3 fails, cancel to release the reserved minutes:
Step 4: starts transcription. Then poll the status endpoint.
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.
| Status | Meaning / app behaviour |
|---|---|
| 400 | Bad request — check required fields |
| 401 | Token expired/invalid — renew silently, else sign in again |
| 402 | License expired or no minutes left |
| 403 | Re-run /clinician/access; show lock screen if denied |
| 404 | Not found |
| 409 | ORG_SELECTION_REQUIRED → pick organization, retry with X-Org-Id; on SaveConsultation: already saved |
| 429 | Rate limited — wait and retry |
| 500 | Server error |