Skip to content

SunCharts Connect API

OAuth 2.0

Connect API 1.1.0 2 operations openapi.json ↓

# Client-credentials token (legacy JSON alias of /oauth/token)

POST /api/v1/partner/token

Access No credential

Request body application/json · required

Fields ClientCredentialsRequest · 4
Field Type Details
client_id required string
client_secret required string
grant_type required constant always client_credentials
scope string
Example request body placeholder values
{
  "client_id": "string",
  "client_secret": "string",
  "grant_type": "client_credentials",
  "scope": "string"
}

Responses

200 Token application/json
Fields PartnerToken · 4
Field Type Details
access_token required string
expires_in required integer
scope required string
token_type required constant always Bearer
Example response placeholder values
{
  "access_token": "string",
  "expires_in": 1,
  "scope": "string",
  "token_type": "Bearer"
}
default Error (neutral code) application/json
Fields Error · 5
Field Type Details
error required string Stable machine code. Known values: `unauthorized`, `forbidden`, `not_found`, `bad_request`, `conflict`, `rate_limited`, `mfa_required`, `mfa_invalid`, `mfa_enrollment_required`, `openemr_link_required`, `openemr_relink_required`, `upstream_error`, `internal`. New codes may be added within v1: treat unknown values like the HTTP status.
connection_id string EHR connection that needs (re)linking (on `openemr_link_required` / `openemr_relink_required`)
link string How to link the connection (on `openemr_link_required` / `openemr_relink_required`)
message string Human-readable detail (do not branch on it; on 409 the text before the first `:` is a sub-code)
retry_after integer Seconds to wait (on `rate_limited`; also sent as `Retry-After`)

Example call

curl -X POST "https://sandbox-api.suncharts.app/api/v1/partner/token" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d @body.json

# OAuth2 client-credentials token

POST /oauth/token

RFC 6749 §4.4. Client auth via HTTP Basic or body fields. Response has `Cache-Control: no-store`.

Access Client ID and secret (HTTP Basic)

Request body application/json · required

Fields OAuthTokenRequest · 4
Field Type Details
grant_type required constant always client_credentials
client_id string Omit when using HTTP Basic
client_secret string Omit when using HTTP Basic
scope string Space-separated subset of the app's scopes
Example request body placeholder values
{
  "grant_type": "client_credentials",
  "client_id": "string",
  "client_secret": "string",
  "scope": "string"
}

Responses

200 Access token application/json
Fields PartnerToken · 4
Field Type Details
access_token required string
expires_in required integer
scope required string
token_type required constant always Bearer
Example response placeholder values
{
  "access_token": "string",
  "expires_in": 1,
  "scope": "string",
  "token_type": "Bearer"
}
400 RFC 6749 error application/json
Fields OAuthError · 2
Field Type Details
error required string one of invalid_request, invalid_client, unsupported_grant_type, invalid_scope
error_description string
401 invalid_client application/json
Fields OAuthError · 2
Field Type Details
error required string one of invalid_request, invalid_client, unsupported_grant_type, invalid_scope
error_description string
429 Error (neutral code) application/json
Fields Error · 5
Field Type Details
error required string Stable machine code. Known values: `unauthorized`, `forbidden`, `not_found`, `bad_request`, `conflict`, `rate_limited`, `mfa_required`, `mfa_invalid`, `mfa_enrollment_required`, `openemr_link_required`, `openemr_relink_required`, `upstream_error`, `internal`. New codes may be added within v1: treat unknown values like the HTTP status.
connection_id string EHR connection that needs (re)linking (on `openemr_link_required` / `openemr_relink_required`)
link string How to link the connection (on `openemr_link_required` / `openemr_relink_required`)
message string Human-readable detail (do not branch on it; on 409 the text before the first `:` is a sub-code)
retry_after integer Seconds to wait (on `rate_limited`; also sent as `Retry-After`)

Example call

curl -s https://sandbox-api.suncharts.app/oauth/token -u "$CLIENT_ID:$CLIENT_SECRET" \
  -d grant_type=client_credentials -d scope="partner.read tenants.read"