01 · READ ONLY
Nothing is written back
The API has no calls that change health records. The source systems stay untouched.
SAUMO API · FOR DEVELOPERS
The Saumo API gives your application read access to health data that Saumo has mapped to FHIR R4. One access policy decides what each call may see, and every read is logged with who, role, purpose and device. The API never writes back to source systems.
WHAT THE API IS
Saumo reads your organisation’s sources, maps them to FHIR R4 with a person approving the mapping, and keeps the result in repositories. Applications read those repositories through the API, and only through the API.
01 · READ ONLY
The API has no calls that change health records. The source systems stay untouched.
02 · ACCESS POLICY
A token reads only where its scopes, the application’s registration and the access granted to the person or system overlap. What the policy holds back is counted in withheld, never sent.
03 · PURPOSE
Each read sends an X-Saumo-Purpose header. A purpose that the account or application is not allowed is refused with 403.
04 · ACCESS LOG
Who, account role and work role, purpose, repository, device, path, patient ids, counts and status, with a request id. Refusals too. Never the data, never a token.
QUICK START
Every call below works against the sandbox. Swap the placeholders for your own values.
Placeholders: <your-saumo> is the address of your organisation’s Saumo, <client_id> and <client_secret> come from the registration.
The SMART configuration is public. Keep issuer: you check it on the redirect.
curl https://<your-saumo>/.well-known/smart-configuration {"issuer": "https://<your-saumo>",
"authorization_endpoint": "https://<your-saumo>/oauth/authorize",
"token_endpoint": "https://<your-saumo>/oauth/token",
"revocation_endpoint": "https://<your-saumo>/oauth/revoke",
"code_challenge_methods_supported": ["S256"],
"token_endpoint_auth_methods_supported": ["none", "client_secret_basic"],
...} Open the authorize address in a browser. redirect_uri must be one of your registered addresses exactly, and aud must be the API base, https://<your-saumo>/api/v1. code_challenge is the base64url SHA-256 of your code_verifier. Saumo redirects back with code, state and iss: check that state is the one you sent and iss equals the issuer, or exchange nothing.
https://<your-saumo>/oauth/authorize
?response_type=code
&client_id=<client_id>
&redirect_uri=<redirect_uri>
&scope=openid%20offline_access%20user%2F*.read
&state=<state>
&code_challenge=<code_challenge>
&code_challenge_method=S256
&aud=https%3A%2F%2F<your-saumo>%2Fapi%2Fv1 <redirect_uri>?code=<code>&state=<state>&iss=https%3A%2F%2F<your-saumo> The code works once, within 60 seconds, for the same client, redirect address and verifier. Never retry a failed exchange: start a new sign-in. A confidential client sends its id and secret with HTTP Basic instead of client_id in the body.
curl -X POST https://<your-saumo>/oauth/token \
--data-urlencode grant_type=authorization_code \
--data-urlencode code=<code> \
--data-urlencode redirect_uri=<redirect_uri> \
--data-urlencode client_id=<client_id> \
--data-urlencode code_verifier=<code_verifier> {"access_token": "<access_token>", "token_type": "Bearer", "expires_in": 900,
"refresh_token": "<refresh_token>", "scope": "offline_access user/*.read",
"session_ends_at": "2026-10-13T19:10:00Z",
"user": {"id": 7, "name": "Example Reader", "role": "data_reader",
"work_role": {"code": "tester", "label": "Tester"},
"purposes": [{"code": "testing", "label": "Testing"}],
"repositories": [{"short_name": "sandbox", "name": "Sandbox",
"resource_types": ["Patient", "MedicationStatement"]}]},
"device": {"family_id": "<family_id>", "name": "<device_name>"}} curl -X POST https://<your-saumo>/oauth/token \
--data-urlencode grant_type=refresh_token \
--data-urlencode refresh_token=<refresh_token> \
--data-urlencode client_id=<client_id> A system-to-system application asks for its own token with its id and secret.
curl -X POST https://<your-saumo>/oauth/token \
-u '<client_id>:<client_secret>' \
--data-urlencode grant_type=client_credentials \
--data-urlencode 'scope=system/*.read' {"access_token": "<access_token>", "token_type": "Bearer", "expires_in": 900,
"scope": "system/*.read"} Send the token in the Authorization header and the purpose in X-Saumo-Purpose. Every answer names the repository it read and lists in withheld what the access policy held back.
curl 'https://<your-saumo>/api/v1/patients?q=<name>&limit=20' \
-H 'Authorization: Bearer <access_token>' \
-H 'X-Saumo-Purpose: <purpose_code>' \
-H 'X-Saumo-Reason: <optional, at most 200 characters>' {"patients": [{"id": "sbx-1", "name": "Example Person", "birth_date": "1941-03-02",
"gender": "female", "identifier_masked": "020341-****",
"source": "Organization/<source>"}],
"repository": "sandbox", "withheld": []} curl 'https://<your-saumo>/api/v1/patients/<id>' \
-H 'Authorization: Bearer <access_token>' \
-H 'X-Saumo-Purpose: <purpose_code>' {"patient": {"resourceType": "Patient", "id": "<id>", ...},
"repository": "sandbox", "withheld": []} curl 'https://<your-saumo>/api/v1/patients/<id>/resources?types=Condition,MedicationStatement&since=2026-01-01' \
-H 'Authorization: Bearer <access_token>' \
-H 'X-Saumo-Purpose: <purpose_code>' {"patient_id": "<id>", "repository": "sandbox",
"resources": {"Condition": [...], "MedicationStatement": [...]},
"withheld": [{"type": "Condition", "count": 2, "reason": "..."}]} q a name, identifier an exact identifier, limit default 20 and at most 100, repository. Nobody found and a repository without access give the same empty list.types comma separated, since a date yyyy-mm-dd, limit per type default 200 and at most 1,000, repository. Only types within your access are read.Authorization: Bearer header. A token in the address, a form field or a cookie is never read.X-Saumo-Purpose is a purpose code. For a person, one of user.purposes in the token answer (in the sandbox: testing). A system application sends the purpose it was registered with. A purpose query parameter is ignored.X-Saumo-Reason is optional, at most 200 characters, and kept in the access log with identity codes masked.repository=<short_name>; with one, it is optional.x-request-id. Labels and error messages follow Accept-Language (en, fi, sv).DATA AND PRIVACY
You never need real patient data to build against Saumo.
SANDBOX
An admin invites you as a developer. A developer account sees one synthetic repository (short name sandbox, ids start with sbx-), the sandbox applications you register and the test users you create. Only your own test users can connect your sandbox applications.
REQUEST LOG
The developer area shows the access log rows of your own sandbox applications for the last 7 days.
IDENTITY CODES
Identity codes are masked in every answer, for example 020341-****. A search by identifier matches the full code but never echoes it.
PEOPLE’S RIGHTS
People have the right to know who has accessed their data. Every call leaves one access log row, so the organisation can answer.
GET ACCESS
Ask your organisation’s Saumo admin to register your application. If your organisation does not use Saumo yet, or you build a product for many organisations, contact us.
The full endpoint reference is inside Saumo at https://<your-saumo>/developer/docs/api, for signed-in developers.