SSoma HealthFHIR API
Getting started

SMART App Launch

Patient apps (MySoma sign-in) and provider apps opened from Soma: authorization code with PKCE, refresh tokens and OpenID Connect.

Apps that act for a patient or for a provider sign in with SMART App Launch 2.0. Server-to-server apps keep using SMART Backend Services.

Kinds of apps

App typeHow it startsScopesfhirUser
Patient appStandalone launch: your app sends the patient to /auth/authorize; they sign in to MySoma (with a one-time code) and choose what to share.patient/*.rs, patient/Condition.rs?category=…, v1 patient/*.readPatient/{id}
Provider appEHR launch: a provider opens your app from a patient's chart in Soma; Soma opens your launch URL with iss and launch.user/*.rs, patient/*.rs, launchPractitioner/{id}

The practice registers your app in Settings › Integrations › FHIR API with its type, redirect URLs (exact match), launch URL (provider apps), the resources it may read and how it signs in at the token endpoint: a client secret (client_secret_basic or client_secret_post; shown to the practice once), private_key_jwt (your public JWKS), or none for public apps (PKCE only).

Endpoints

GET/.well-known/smart-configurationEndpoints, capabilities and scopes (no sign-in).
GET/.well-known/openid-configurationOpenID Connect discovery; the issuer is the FHIR base URL.
GET/.well-known/jwks.jsonThe practice's public key for id_token signatures (RS256).
GET/auth/authorizeAuthorization request (POST with a form works too).
POST/auth/tokenauthorization_code and refresh_token grants.
POST/auth/introspectToken introspection (RFC 7662).
POST/auth/revokeToken revocation (RFC 7009).

Authorization request

Patient app
https://dev3.somahealth.com/api/fhir/r4/{practice}/auth/authorize?response_type=code&client_id={client_id}
  &redirect_uri={registered redirect}&scope=launch/patient openid fhirUser offline_access patient/*.rs
  &state={random}&aud={FHIR base URL}&code_challenge={S256 challenge}&code_challenge_method=S256
  • aud must be the practice's FHIR base URL, and redirect_uri one the practice registered; otherwise the patient sees an error page and isn't sent back.
  • PKCE is required, with S256 only. state is required.
  • Provider apps add the launch value Soma gave them; it works once, within 5 minutes.
  • The patient may uncheck scopes. The token response's scope lists what was granted, which can be less than you asked for.

Token response

200 OK
{
  "access_token": "fhr_…",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "launch/patient openid fhirUser offline_access patient/Patient.rs patient/Condition.rs",
  "refresh_token": "fhrr_…",
  "id_token": "eyJ…",
  "patient": "{Patient id}",
  "need_patient_banner": true
}
  • Access tokens last 1 hour. Refresh tokens: offline_access 92 days, online_access 24 hours. A refresh returns a new access token and the same refresh token; it may narrow scope, never widen it.
  • Provider launches add encounter when the provider opened the app from a visit.
  • Patient-context tokens see only that patient's record: searches default to the patient, and other patients aren't found.
  • The id_token is signed RS256 (kid in the JWKS); iss is the FHIR base URL, aud your client_id, and it carries fhirUser.

Ending access

Patients see the apps they connected in MySoma › Connected apps and can turn one off; the practice can pause or remove an app. Either takes effect right away: the next request with the app's tokens gets a 401, and its refresh token stops working. Apps can end their own tokens with /auth/revoke.

Clinical summary ($docref)

GET/DocumentReference/$docref?patient={id}The patient's Continuity of Care Document (C-CDA R2.1), made on request.

Returns a Bundle with one DocumentReference (LOINC 34133-9) whose attachment holds the CCD as base64 application/xml. Patient apps may leave out patient.