API reference
POSTGet an access token
Exchange a signed client assertion for a 5-minute access token.
POST
[base]/auth/tokenForm-encoded. Returns an access token. See Authentication for building the assertion.| Form field | Required | Value |
|---|---|---|
grant_type | Yes | client_credentials |
client_assertion_type | Yes | urn:ietf:params:oauth:client-assertion-type:jwt-bearer |
client_assertion | Yes | Your signed JWT. |
scope | Yes | Space-separated system scopes, e.g. system/Appointment.rs system/Slot.rs. |
client_id | No | If sent, it must match the assertion's iss. |
curl -X POST https://dev3.somahealth.com/api/fhir/r4/your-practice/auth/token \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=client_credentials" \
--data-urlencode "scope=system/Slot.rs" \
--data-urlencode "client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer" \
--data-urlencode "client_assertion=$ASSERTION"{
"access_token": "q2ZkY3Vt…",
"token_type": "bearer",
"expires_in": 300,
"scope": "system/Slot.rs"
}{
"error": "invalid_scope",
"error_description": "None of the requested scopes is allowed. Ask for system/{Resource}.rs (or .read) for resources the practice gave this app."
}Responses carry Cache-Control: no-store. Each assertion's jti can be used once.