# SMART Backend Services

Canonical URL: https://docs.chartvoyant.com/smart-backend-services/
Endpoint: `POST https://auth.chartvoyant.com/oauth/token`

System-to-system FHIR access with no user at the keyboard, for a population-health platform, a network, or a practice's own systems. The practice authorizes your system, and your server proves who it is with a signed assertion.

## At a glance

| Status | Live in production for read and Bulk Data. System write scopes and the HL7 sender scope are deployed and granted per practice and client. |
| --- | --- |
| Grant | `client_credentials` with a `private_key_jwt` client assertion. |
| Signing | RS384 or ES384. You keep the private key; we hold only your public JWKS or HTTPS `jwks_uri`. |
| Token endpoint | `https://auth.chartvoyant.com/oauth/token` |
| Scope of access | One practice per client, limited to the scopes that practice allows. A system token reads any patient in that practice, and searches must name the patient. Writes, when turned on, are submissions a clinician reviews. |
| Registration | Granted, not self-service: the practice explicitly authorizes your system before your keys are registered for it. |
| Cost | No fee and no revenue share. |

## Request a token

Sign a fresh JWT for every token request (synthetic placeholders throughout):

JWT Assertion

```
// Header (sign with your private key; never send the private key anywhere)
{"alg":"RS384","typ":"JWT","kid":"YOUR_PUBLIC_KEY_ID"}
// Claims
{"iss":"YOUR_CLIENT_ID","sub":"YOUR_CLIENT_ID",
 "aud":"https://auth.chartvoyant.com/oauth/token",
 "exp":NOW_PLUS_300,"jti":"NEW_RANDOM_ID"}
```

    cURLTypeScript
    Copy

```
curl -X POST "https://auth.chartvoyant.com/oauth/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "grant_type=client_credentials" \
  --data-urlencode "scope=system/Patient.rs system/Observation.rs" \
  --data-urlencode "client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer" \
  --data-urlencode "client_assertion=$SIGNED_JWT"
```

```
const body = new URLSearchParams({
  grant_type: "client_credentials",
  scope: "system/Patient.rs system/Observation.rs",
  client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
  client_assertion: signedJwt
});
const res = await fetch("https://auth.chartvoyant.com/oauth/token", {
  method: "POST",
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
  body
});
const { access_token, expires_in, scope } = await res.json();
```

- `iss` and `sub` are your client ID, `aud` is the exact token endpoint, `exp` is no more than five minutes ahead, and `jti` is unique per request.

- Replayed assertions, unregistered keys, and unregistered algorithms are rejected.

- The response carries an access token that lasts 3,600 seconds (300 seconds when it carries a write scope) and the granted scope. There is no refresh token and no ID token; sign a new assertion for a new token.

## Scopes

| Scope | Meaning |
| --- | --- |
| `system/{Type}.rs` | Read and search one supported [resource type](https://docs.chartvoyant.com/fhir-r4/#resources) across the practice. |
| `system/*.rs` | Every supported type, including all Bulk Data export classes. |
| `system/Group.rs` | Discover and read the practice's Group, which [Bulk Data](https://docs.chartvoyant.com/bulk-data/) needs. |
| `system/{Type}.cu` | Create and update (`.c`, `.u`, or both) for the types a practice approves for your client, through [SMART write](https://docs.chartvoyant.com/smart-write/). Every submission waits for a clinician. |
| `system/hl7v2-ingest` | Deliver HL7 v2 messages to one [HL7 interface](https://docs.chartvoyant.com/hl7/). Not a FHIR permission: `system/*.rs` does not include it, discovery does not list it, and a token with only this scope reads nothing. Granted only to a client registered for it, using `private_key_jwt`. |

A patient or clinician token cannot start a population export.

## How to get access

- **Read the guide** The [SMART on FHIR-4 developer guide](https://docs.chartvoyant.com/fhir/) and the public [practice directory](https://chartvoyant.com/fhir/service-base-urls.json) need no account, payment, or agreement.

- **Request registration** Email [info@chartvoyant.com](mailto:info@chartvoyant.com?subject=SMART%20Backend%20Services%20registration%20request) or use [Support](https://chartvoyant.com/support/) with your system name, developer contact, authorizing practice, requested system scopes, and public JWKS or HTTPS `jwks_uri` (RS384 or ES384). Send no patient records or private keys.

- **We register and enable it** We apply the same identity and configuration checks to every developer and enable a complete eligible request within five business days.

- **Authorize and connect** The practice authorizes your system for its data. Request a token with a signed assertion and call its FHIR base.
