# Get an access token

> Exchange a signed client assertion for a 5-minute access token.

`POST [base]/auth/token` — Form-encoded. Returns an access token. See [Authentication](/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`. |

*Request*

```bash
curl -X POST https://qa3.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"
```

*200 response*

```json
{
  "access_token": "q2ZkY3Vt…",
  "token_type": "bearer",
  "expires_in": 300,
  "scope": "system/Slot.rs"
}
```

*400 response*

```json
{
  "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.

---
Last updated 2026-12-04 · Soma Health FHIR API
