Skip to content

SunCharts EHR API

Integrations

EHR API as of 26.11.11.41 43 operations openapi.json ↓

# List reviewed connectors bundled with this EHR build

GET /api/v1/connector-catalog/builtins

Staff-only and tenant-scoped. Each result includes the declarative manifest, whether that connector is already installed for the tenant, and builtin provenance. This endpoint exposes no secrets and loads no remote code.

Access OAuth 2.0 access tokenclinical.read

Responses

200 Bundled manifests and tenant installation state
403 Staff role required

Example call

curl "$EHR_URL/api/v1/connector-catalog/builtins" -H "Authorization: Bearer $ACCESS_TOKEN"

# Install one reviewed bundled connector

POST /api/v1/connector-catalog/builtins/{connector_id}/install

Owner-only and idempotent by request_id. The selected manifest and its compiled action identifiers ship with the EHR; callers cannot provide executable code, arbitrary URLs or provider credentials.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
connector_id required path string

Request body application/json · required

Fields object · 2
Field Type Details
reason required string length 1–1000
request_id required string (uuid)
Example request body placeholder values
{
  "reason": "string",
  "request_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 Installed connector or the same idempotent result
403 Owner role required
404 Bundled connector not found
409 Request identity conflict or connector already installed

Example call

curl -X POST "$EHR_URL/api/v1/connector-catalog/builtins/{connector_id}/install" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# List installed open connector manifests

GET /api/v1/connector-catalog/installations

Staff-only, tenant-scoped catalog. Returns at most 200 installations and public source provenance; it never returns credentials.

Access OAuth 2.0 access tokenclinical.read

Responses

200 Installed connector metadata
403 Staff role required

Example call

curl "$EHR_URL/api/v1/connector-catalog/installations" -H "Authorization: Bearer $ACCESS_TOKEN"

# Install a declarative open connector manifest

POST /api/v1/connector-catalog/installations

Owner-only and idempotent by request_id. The manifest is data, not executable code: arbitrary scripts, HTTP targets, headers and templates are not accepted. Source repository, revision and digest are retained as public provenance.

Access OAuth 2.0 access tokenclinical.read

Request body application/json · required

Fields object · 58
Field Type Details
manifest required ConnectorManifest Declarative open-source connector contract. At least one trigger or action is required. Executable code, arbitrary HTTP targets, headers and templates are not part of this manifest.
actions required array of ConnectorActionDefinition items ≤ 128
approval required any one of none, staff, clinical, owner
auth_scheme required string or null
description required string
effect required any one of read, write, external_send, clinical_write, billing_write
id required string
idempotency required any one of none, request_key, natural_key
implementation required string Identifier of an adapter compiled into the EHR; never a URL or script.
input required ConnectorObjectSchema
fields required array of ConnectorFieldSchema items ≤ 50
output required ConnectorObjectSchema
fields required array of ConnectorFieldSchema items ≤ 50
phi required any one of none, identifiers, limited, clinical, billing
required_roles required array of string
required_scopes required array of string
retry required any one of never, read_only, safe_idempotent
title required string
transport required any one of native, provider_api
api_version required constant always suncharts.dev/connector/v1
auth_schemes required array of ConnectorAuthScheme items ≤ 8
credential_fields required array of object items ≤ 16
id required string
secret required boolean
title required string
id required string
kind required any one of none, api_key, oauth2, oauth2_client
scopes required array of string items ≤ 64
description required string length ≤ 1000
homepage required string (uri) pattern ^https://
id required string length 3–120
license required any one of AGPL-3.0-only, Apache-2.0, MIT, BSD-2-Clause, BSD-3-Clause, MPL-2.0
lifecycle required ConnectorLifecycle
deactivate required boolean
sample_events required boolean
setup required boolean
name required string length 2–120
repository required string (uri) pattern ^https://
triggers required array of ConnectorTriggerDefinition items ≤ 64
auth_scheme required string or null
description required string
event_type required string
id required string
output required ConnectorObjectSchema
fields required array of ConnectorFieldSchema items ≤ 50
phi required any one of none, identifiers, limited, clinical, billing
required_roles required array of string
required_scopes required array of string
title required string
transport required any one of internal_event, webhook, websocket, polling
dispatch_action string or null Optional action ID in the same manifest staged by the durable runtime when this exact trigger is delivered. Trigger output and action input schemas must match exactly.
version required string Semantic version.
provenance required ConnectorProvenance
repository_url required string (uri) pattern ^https://
source_digest required string pattern ^[A-Fa-f0-9]{64}$
source_revision required string length 7–200
reason required string length 1–1000
request_id required string (uuid)
Example request body placeholder values
{
  "manifest": {
    "actions": [
      {
        "approval": "none",
        "auth_scheme": "string",
        "description": "string",
        "effect": "read",
        "id": "string",
        "idempotency": "none",
        "implementation": "string",
        "input": {
          "fields": null
        },
        "output": {
          "fields": null
        },
        "phi": "none",
        "required_roles": [],
        "required_scopes": [],
        "retry": "never",
        "title": "string",
        "transport": "native"
      }
    ],
    "api_version": "suncharts.dev/connector/v1",
    "auth_schemes": [
      {
        "credential_fields": [],
        "id": "string",
        "kind": "none",
        "scopes": []
      }
    ],
    "description": "string",
    "homepage": "https://app.example.test/callback",
    "id": "string",
    "license": "AGPL-3.0-only",
    "lifecycle": {
      "deactivate": true,
      "sample_events": true,
      "setup": true
    },
    "name": "string",
    "repository": "https://app.example.test/callback",
    "triggers": [
      {
        "auth_scheme": "string",
        "description": "string",
        "event_type": "string",
        "id": "string",
        "output": {
          "fields": null
        },
        "phi": "none",
        "required_roles": [],
        "required_scopes": [],
        "title": "string",
        "transport": "internal_event"
      }
    ],
    "version": "string"
  },
  "provenance": {
    "repository_url": "https://app.example.test/callback",
    "source_digest": "string",
    "source_revision": "string"
  },
  "reason": "string",
  "request_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 Installed connector or the same idempotent result
400 Manifest, provenance or reason is invalid
403 Owner role required
409 Request ID reused or connector already installed

Example call

curl -X POST "$EHR_URL/api/v1/connector-catalog/installations" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Read one connector installation and its immutable history

GET /api/v1/connector-catalog/installations/{id}

Staff-only and tenant-scoped. Reading is audited. No connector credential material is stored in this catalog.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Responses

200 Installation, current manifest, revisions and events
403 Staff role required
404 Installation not found in tenant

Example call

curl "$EHR_URL/api/v1/connector-catalog/installations/{id}" -H "Authorization: Bearer $ACCESS_TOKEN"

# Install a new immutable manifest revision

PUT /api/v1/connector-catalog/installations/{id}

Owner-only. Requires the current quoted installation version. Connector identity cannot change, and deactivated connectors cannot be revised.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
If-Match required header string Quoted current resource version.

Request body application/json · required

Fields object · 57
Field Type Details
manifest required ConnectorManifest Declarative open-source connector contract. At least one trigger or action is required. Executable code, arbitrary HTTP targets, headers and templates are not part of this manifest.
actions required array of ConnectorActionDefinition items ≤ 128
approval required any one of none, staff, clinical, owner
auth_scheme required string or null
description required string
effect required any one of read, write, external_send, clinical_write, billing_write
id required string
idempotency required any one of none, request_key, natural_key
implementation required string Identifier of an adapter compiled into the EHR; never a URL or script.
input required ConnectorObjectSchema
fields required array of ConnectorFieldSchema items ≤ 50
output required ConnectorObjectSchema
fields required array of ConnectorFieldSchema items ≤ 50
phi required any one of none, identifiers, limited, clinical, billing
required_roles required array of string
required_scopes required array of string
retry required any one of never, read_only, safe_idempotent
title required string
transport required any one of native, provider_api
api_version required constant always suncharts.dev/connector/v1
auth_schemes required array of ConnectorAuthScheme items ≤ 8
credential_fields required array of object items ≤ 16
id required string
secret required boolean
title required string
id required string
kind required any one of none, api_key, oauth2, oauth2_client
scopes required array of string items ≤ 64
description required string length ≤ 1000
homepage required string (uri) pattern ^https://
id required string length 3–120
license required any one of AGPL-3.0-only, Apache-2.0, MIT, BSD-2-Clause, BSD-3-Clause, MPL-2.0
lifecycle required ConnectorLifecycle
deactivate required boolean
sample_events required boolean
setup required boolean
name required string length 2–120
repository required string (uri) pattern ^https://
triggers required array of ConnectorTriggerDefinition items ≤ 64
auth_scheme required string or null
description required string
event_type required string
id required string
output required ConnectorObjectSchema
fields required array of ConnectorFieldSchema items ≤ 50
phi required any one of none, identifiers, limited, clinical, billing
required_roles required array of string
required_scopes required array of string
title required string
transport required any one of internal_event, webhook, websocket, polling
dispatch_action string or null Optional action ID in the same manifest staged by the durable runtime when this exact trigger is delivered. Trigger output and action input schemas must match exactly.
version required string Semantic version.
provenance required ConnectorProvenance
repository_url required string (uri) pattern ^https://
source_digest required string pattern ^[A-Fa-f0-9]{64}$
source_revision required string length 7–200
reason required string length 1–1000
Example request body placeholder values
{
  "manifest": {
    "actions": [
      {
        "approval": "none",
        "auth_scheme": "string",
        "description": "string",
        "effect": "read",
        "id": "string",
        "idempotency": "none",
        "implementation": "string",
        "input": {
          "fields": null
        },
        "output": {
          "fields": null
        },
        "phi": "none",
        "required_roles": [],
        "required_scopes": [],
        "retry": "never",
        "title": "string",
        "transport": "native"
      }
    ],
    "api_version": "suncharts.dev/connector/v1",
    "auth_schemes": [
      {
        "credential_fields": [],
        "id": "string",
        "kind": "none",
        "scopes": []
      }
    ],
    "description": "string",
    "homepage": "https://app.example.test/callback",
    "id": "string",
    "license": "AGPL-3.0-only",
    "lifecycle": {
      "deactivate": true,
      "sample_events": true,
      "setup": true
    },
    "name": "string",
    "repository": "https://app.example.test/callback",
    "triggers": [
      {
        "auth_scheme": "string",
        "description": "string",
        "event_type": "string",
        "id": "string",
        "output": {
          "fields": null
        },
        "phi": "none",
        "required_roles": [],
        "required_scopes": [],
        "title": "string",
        "transport": "internal_event"
      }
    ],
    "version": "string"
  },
  "provenance": {
    "repository_url": "https://app.example.test/callback",
    "source_digest": "string",
    "source_revision": "string"
  },
  "reason": "string"
}

Responses

200 Updated installation with new current revision
403 Owner role required
409 Stale version, deactivated installation, unchanged version or identity mismatch
428 Current If-Match required

Example call

curl -X PUT "$EHR_URL/api/v1/connector-catalog/installations/{id}" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Enable, disable or permanently deactivate a connector

POST /api/v1/connector-catalog/installations/{id}/actions

Owner-only and versioned. Disabling or deactivating a connector stops its trigger subscriptions; deactivated connectors cannot be enabled again.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
If-Match required header string Quoted current resource version.

Request body application/json · required

Fields object · 2
Field Type Details
action required any one of enable, disable, deactivate
reason required string length 1–1000
Example request body placeholder values
{
  "action": "enable",
  "reason": "string"
}

Responses

200 Updated installation state
403 Owner role required
409 Stale version or invalid transition
428 Current If-Match required

Example call

curl -X POST "$EHR_URL/api/v1/connector-catalog/installations/{id}/actions" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# List tenant instance integrations

GET /api/v1/integrations

Never returns credential or OAuth callback material.

Access OAuth 2.0 access tokenclinical.read

Responses

200 At most 100 tenant integrations plus credential-storage readiness
403 Owner role required

Example call

curl "$EHR_URL/api/v1/integrations" -H "Authorization: Bearer $ACCESS_TOKEN"

# Create an instance-local integration setting

POST /api/v1/integrations

At most 50 integrations per tenant. Protected credential is encrypted and never echoed. HealthClinics accepts oauth_client_id in config and rejects a vendor credential.

Access OAuth 2.0 access tokenclinical.read

Request body application/json · required

Fields object · 5
Field Type Details
label required string length 1–120
provider required any one of ringcentral, gmail, claude, erebine, healthclinics
capabilities array of string
config object Non-secret provider configuration, at most 32 KiB; credential-like keys are rejected recursively. Erebine requires ErebineConfig: project_id and model, with optional workspace_id and endpoint_slug.
credential string Protected secret input; never returned. Not accepted for HealthClinics. length 8–16384
Example request body placeholder values
{
  "label": "string",
  "provider": "ringcentral",
  "capabilities": [
    "string"
  ],
  "config": {},
  "credential": "string"
}

Responses

200 Public integration state without secret material
400 Unsupported provider, capability or secret-bearing config
403 Owner role required

Example call

curl -X POST "$EHR_URL/api/v1/integrations" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Discover Erebine models before saving a connection

POST /api/v1/integrations/erebine/models

Owner-only and audited. Uses the native SDK and supplied protected credential without persisting it. Returns bounded model IDs only; no credential or provider response body is returned.

Access OAuth 2.0 access tokenclinical.read

Request body application/json · required

Fields object · 6
Field Type Details
config required ErebineRoutingConfig Native Erebine SDK routing uses the fixed HTTPS api.erebine.ai origin. Arbitrary origins and unknown configuration keys are rejected.
project_id required string Required; dot and double-dot identifiers are rejected. length 1–200pattern ^[A-Za-z0-9._-]+$
endpoint_slug string or null Optional endpoint slug; omit for direct routing. Dot and double-dot identifiers are rejected. length 1–200pattern ^[A-Za-z0-9._-]+$
model string or null Required and nonblank when saving or using a connection. Discovery may omit it, use null or an empty string. Other values must have no surrounding whitespace or control characters; at most 120 UTF-8 bytes. length ≤ 120
workspace_id string or null Optional; dot and double-dot identifiers are rejected. length 1–200pattern ^[A-Za-z0-9._-]+$
credential required string length 8–16384
Example request body placeholder values
{
  "config": {
    "project_id": "string",
    "endpoint_slug": "string",
    "model": "string",
    "workspace_id": "string"
  },
  "credential": "string"
}

Responses

200 Success; tenant-scoped data with Cache-Control: no-store application/json
Fields ErebineModels · 2
Field Type Details
models required array of object items ≤ 2000
id required string length 1–120
Example response placeholder values
{
  "models": [
    {
      "id": "string"
    }
  ]
}
400 Invalid routing configuration or credential input
401 Authentication required
403 Owner role required
409 Provider rejected the request or returned unavailable/invalid data; errors disclose only stable categories

Example call

curl -X POST "$EHR_URL/api/v1/integrations/erebine/models" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Exchange a Gmail OAuth code

GET /api/v1/integrations/gmail/oauth/callback

Consumes one state exactly once, exchanges the code with S256 PKCE, and stores access and refresh tokens encrypted in this EHR instance. Tokens and client secrets are never returned.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
state required query string
code query string
error query string

Responses

200 Connected or bounded needs-attention result
400 Invalid callback or rejected token exchange
409 State expired or already used

Example call

curl "$EHR_URL/api/v1/integrations/gmail/oauth/callback" -H "Authorization: Bearer $ACCESS_TOKEN"

# Capture a one-time provider authorization response

GET /api/v1/integrations/oauth/callback

Accepts exactly one of code or error. Callback material is encrypted. A successful capture remains pending_exchange because no vendor token exchange is claimed by this boundary.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
state required query string
code query string
error query string

Responses

200 Response securely captured; pending_exchange or needs_attention
400 Invalid callback shape
404 State not found
409 Intent expired or already used

Example call

curl "$EHR_URL/api/v1/integrations/oauth/callback" -H "Authorization: Bearer $ACCESS_TOKEN"

# List bounded instance-local integration provider contracts

GET /api/v1/integrations/providers

Owner-only catalog for RingCentral, Gmail, clinic-owned Claude and Erebine and HealthClinics as an EHR OAuth client. Catalog entries describe configuration boundaries; they do not claim vendor authentication or enrollment.

Access OAuth 2.0 access tokenclinical.read

Responses

200 Provider auth type, allowed capabilities and boundary
403 Owner role required

Example call

curl "$EHR_URL/api/v1/integrations/providers" -H "Authorization: Bearer $ACCESS_TOKEN"

# Exchange a RingCentral OAuth code

GET /api/v1/integrations/ringcentral/oauth/callback

Consumes one state exactly once, exchanges the code with PKCE and stores rotating access and refresh tokens encrypted in this EHR instance. Provider errors are reduced to a bounded allowlist before audit.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
state required query string
code query string
error query string

Responses

200 Connected or bounded needs-attention result
409 State expired or already used

Example call

curl "$EHR_URL/api/v1/integrations/ringcentral/oauth/callback" -H "Authorization: Bearer $ACCESS_TOKEN"

# List staged RingCentral events

GET /api/v1/integrations/ringcentral/{id}/inbox

Owner-only, tenant-scoped metadata for at most 100 encrypted inbound call, SMS, fax and voicemail events. Reading is audited.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Responses

200 Reviewed queue metadata without decrypted payloads
403 Owner role required

Example call

curl "$EHR_URL/api/v1/integrations/ringcentral/{id}/inbox" -H "Authorization: Bearer $ACCESS_TOKEN"

# Open one encrypted RingCentral event for review

GET /api/v1/integrations/ringcentral/{id}/inbox/{event_id}

Owner-only and audited. Does not infer or attach a patient.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
event_id required path string (uuid)

Responses

200 Decrypted source event plus bounded metadata
403 Owner role required

Example call

curl "$EHR_URL/api/v1/integrations/ringcentral/{id}/inbox/{event_id}" -H "Authorization: Bearer $ACCESS_TOKEN"

# Review, ignore or explicitly link one RingCentral event

POST /api/v1/integrations/ringcentral/{id}/inbox/{event_id}

Owner-only. A patient link is accepted only as an explicit tenant-scoped reviewer decision; phone numbers never auto-link records.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
event_id required path string (uuid)

Request body application/json · required

Fields object · 3
Field Type Details
action required any one of review, ignore
reason required string length 1–500
patient_id string (uuid)
Example request body placeholder values
{
  "action": "review",
  "reason": "string",
  "patient_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 Event reviewed exactly once
409 Event was already reviewed

Example call

curl -X POST "$EHR_URL/api/v1/integrations/ringcentral/{id}/inbox/{event_id}" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Start instance-local RingCentral OAuth with PKCE

POST /api/v1/integrations/ringcentral/{id}/oauth/start

Owner-only. Creates a ten-minute, one-use state and PKCE verifier and returns RingCentral's fixed production or sandbox authorization URL. Secrets and verifier material remain encrypted in this EHR instance.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Request body application/json · required

Fields object · 1
Field Type Details
redirect_uri required string (uri) length ≤ 2000
Example request body placeholder values
{
  "redirect_uri": "https://app.example.test/callback"
}

Responses

200 Bounded authorization URL and expiration
403 Owner role required
409 Integration revoked

Example call

curl -X POST "$EHR_URL/api/v1/integrations/ringcentral/{id}/oauth/start" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# List reviewed RingCentral outbound work

GET /api/v1/integrations/ringcentral/{id}/outbound

Tenant-scoped metadata for at most 100 SMS, fax and RingOut drafts. Encrypted message and document content is omitted from the list.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Responses

200 Outbound draft metadata and provider status
403 Staff role required

Example call

curl "$EHR_URL/api/v1/integrations/ringcentral/{id}/outbound" -H "Authorization: Bearer $ACCESS_TOKEN"

# Create a RingCentral outbound draft

POST /api/v1/integrations/ringcentral/{id}/outbound

Creates encrypted SMS, PDF fax or RingOut content inside this EHR. request_id is the durable idempotency key and reuse with different content is rejected. Owner, clinician, front desk and delegated partner support may draft. No provider call occurs until a separate authorized person confirms the recipient, approves, and explicitly sends.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Request body application/json · required

Fields object · 10
Field Type Details
kind required any one of sms, fax, ringout
recipient required string pattern ^\+[0-9]{8,15}$
request_id required string (uuid)
content_type string one of application/pdf
cover_page_text string Optional fax cover-page text. length ≤ 1024
document_base64 string (byte) Required nonempty PDF for fax; decoded content is limited to 10 MiB.
filename string length ≤ 200pattern ^[A-Za-z0-9._-]+\.pdf$
play_prompt boolean Optional RingOut prompt flag.
sender string Required for SMS; optional for RingOut; rejected for fax. pattern ^\+[0-9]{8,15}$
text string Required for SMS; bounded to 1,000 UTF-16 code units. length ≤ 1000
Example request body placeholder values
{
  "kind": "ringout",
  "play_prompt": true,
  "recipient": "+15550101010",
  "request_id": "00000000-0000-4000-8000-000000000102",
  "sender": "+15550101011"
}

Responses

200 Draft created or identical idempotent replay
400 Invalid kind-specific fields or bounds
403 Drafting role required
409 request_id reused with different content

Example call

curl -X POST "$EHR_URL/api/v1/integrations/ringcentral/{id}/outbound" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Open one RingCentral outbound draft for review

GET /api/v1/integrations/ringcentral/{id}/outbound/{draft_id}

Returns decrypted draft content, metadata and immutable events to authenticated staff in the tenant. Reading is audited.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
draft_id required path string (uuid)

Responses

200 Draft content, state and event history
404 Draft not found in integration

Example call

curl "$EHR_URL/api/v1/integrations/ringcentral/{id}/outbound/{draft_id}" -H "Authorization: Bearer $ACCESS_TOKEN"

# Confirm the recipient and approve a RingCentral draft

POST /api/v1/integrations/ringcentral/{id}/outbound/{draft_id}/approve

Separate human approval gate. Owner or clinician may approve all kinds; front desk may approve SMS and RingOut. Delegated partner support may draft but cannot approve or send. confirmed_recipient must exactly match the saved E.164 recipient. This action does not call RingCentral.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
draft_id required path string (uuid)

Request body application/json · required

Fields object · 3
Field Type Details
confirmed_recipient required string pattern ^\+[0-9]{8,15}$
reason required string length 1–500
request_id required string (uuid)
Example request body placeholder values
{
  "confirmed_recipient": "+15550101010",
  "reason": "string",
  "request_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 Approved or identical approval replay
403 Approval role required
409 Recipient mismatch, reused request or invalid state

Example call

curl -X POST "$EHR_URL/api/v1/integrations/ringcentral/{id}/outbound/{draft_id}/approve" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Reconcile an ambiguous RingCentral outbound result

POST /api/v1/integrations/ringcentral/{id}/outbound/{draft_id}/reconcile

Explicit evidence-backed recovery for a draft left in sending or needs_review. An authorized sender supplies the exact bounded RingCentral provider identifier; SunCharts reads that provider record and accepts the draft only when the returned identifier matches. This never retries the original SMS, fax or RingOut request. Owner or clinician may reconcile all kinds; front desk may reconcile SMS and RingOut.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
draft_id required path string (uuid)

Request body application/json · required

Fields object · 2
Field Type Details
provider_id required string length 1–240pattern ^[A-Za-z0-9_-]+$
reason required string length 1–500
Example request body placeholder values
{
  "provider_id": "synthetic_provider_001",
  "reason": "Matched the provider record to the reviewed synthetic draft."
}

Responses

Example call

curl -X POST "$EHR_URL/api/v1/integrations/ringcentral/{id}/outbound/{draft_id}/reconcile" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Refresh provider status for accepted outbound work

POST /api/v1/integrations/ringcentral/{id}/outbound/{draft_id}/refresh

Reads RingCentral message/fax status for an accepted SMS or fax. RingOut has no supported refresh in this boundary. Provider state is evidence only; it does not silently retry or mutate clinical records.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
draft_id required path string (uuid)

Responses

200 Updated provider status and immutable status event
400 RingOut status refresh unsupported
409 Draft has not been accepted by RingCentral

Example call

curl -X POST "$EHR_URL/api/v1/integrations/ringcentral/{id}/outbound/{draft_id}/refresh" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Explicitly send an approved RingCentral draft

POST /api/v1/integrations/ringcentral/{id}/outbound/{draft_id}/send

Separate send gate after recipient confirmation and approval. Owner or clinician may send all kinds; front desk may send SMS and RingOut. Provider acceptance is recorded but is not proof of SMS/fax delivery or call connection. Ambiguous provider outcomes require review and are never blindly retried.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
draft_id required path string (uuid)

Request body application/json · required

Fields object · 1
Field Type Details
request_id required string (uuid)
Example request body placeholder values
{
  "request_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 Provider accepted or identical send replay; delivery_confirmed remains false
400 Bounded provider failure; inspect the terminal failed or needs_review state rather than blindly retrying
403 Send role required
409 Draft not approved or send request changed

Example call

curl -X POST "$EHR_URL/api/v1/integrations/ringcentral/{id}/outbound/{draft_id}/send" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Enable RingCentral event delivery

POST /api/v1/integrations/ringcentral/{id}/subscription

Owner-only. Outbound WebSocket is the default and requires no public EHR URL. The optional webhook transport requires a clean public HTTPS origin. Events enter a reviewed queue and are never linked to a patient by phone number alone.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Request body application/json · required

Fields object · 2
Field Type Details
public_base_url string (uri) pattern ^https://
transport any one of websocket, webhookdefault websocket
Example request body placeholder values
{
  "public_base_url": "https://app.example.test/callback",
  "transport": "websocket"
}

Responses

200 Transport enabled; WebSocket returns public_url_required false
403 Owner role required

Example call

curl -X POST "$EHR_URL/api/v1/integrations/ringcentral/{id}/subscription" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Test the RingCentral account connection

POST /api/v1/integrations/ringcentral/{id}/test

Owner-only. Refreshes the token when required and verifies the authorized RingCentral extension without returning provider data.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Responses

200 Provider accepted the connection
403 Owner role required

Example call

curl -X POST "$EHR_URL/api/v1/integrations/ringcentral/{id}/test" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Read integration state and immutable event history

GET /api/v1/integrations/{id}

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Responses

200 Public integration state and up to 100 events; no secret material
403 Owner role required
404 Integration not found in tenant

Example call

curl "$EHR_URL/api/v1/integrations/{id}" -H "Authorization: Bearer $ACCESS_TOKEN"

# Versioned settings update or credential rotation

PUT /api/v1/integrations/{id}

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
If-Match required header string

Request body application/json · required

Fields object · 4
Field Type Details
label required string length 1–120
capabilities array of string
config object Non-secret provider configuration, at most 32 KiB; credential-like keys are rejected recursively. Erebine requires ErebineConfig: project_id and model, with optional workspace_id and endpoint_slug.
credential string Optional protected replacement; never returned. length 8–16384
Example request body placeholder values
{
  "label": "string",
  "capabilities": [
    "string"
  ],
  "config": {},
  "credential": "string"
}

Responses

200 Updated public integration state
409 Stale or revoked integration
428 Current If-Match required

Example call

curl -X PUT "$EHR_URL/api/v1/integrations/{id}" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Test local readiness, enable, disable or revoke

POST /api/v1/integrations/{id}/actions

The test action only verifies local encrypted credential readability or a tenant HealthClinics OAuth client. It does not call a vendor or prove vendor acceptance. Enabling a non-HealthClinics adapter leaves it pending until a real adapter completes its official contract.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
If-Match required header string

Request body application/json · required

Fields object · 1
Field Type Details
action required any one of test, enable, disable, revoke
Example request body placeholder values
{
  "action": "test"
}

Responses

200 Updated public integration state
400 Missing credential or OAuth client, or unsupported action
409 Stale or revoked integration
428 Current If-Match required

Example call

curl -X POST "$EHR_URL/api/v1/integrations/{id}/actions" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Discover models for a saved Erebine connection

GET /api/v1/integrations/{id}/erebine/models

Owner-only and audited. Uses the current encrypted credential on a tenant-owned, nonrevoked Erebine connection; enabled status is not required. Returns bounded model IDs only.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Responses

200 Success; tenant-scoped data with Cache-Control: no-store application/json
Fields ErebineModels · 2
Field Type Details
models required array of object items ≤ 2000
id required string length 1–120
Example response placeholder values
{
  "models": [
    {
      "id": "string"
    }
  ]
}
400 Invalid routing configuration or credential input
401 Authentication required
403 Owner role required
404 Erebine connection or stored credential not found in tenant
409 Provider rejected the request or returned unavailable/invalid data; errors disclose only stable categories

Example call

curl "$EHR_URL/api/v1/integrations/{id}/erebine/models" -H "Authorization: Bearer $ACCESS_TOKEN"

# Start instance-local Gmail OAuth with PKCE

POST /api/v1/integrations/{id}/gmail/oauth/start

Owner-only. Uses the clinic's Google OAuth client ID and encrypted client secret, requests gmail.readonly plus gmail.send, and returns Google's authorization URL. Gmail read access is restricted and send access is sensitive; production use may require Google verification and a security assessment. Existing connections must reconnect before outbound sending when gmail.send was not granted.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Request body application/json · required

Fields object · 1
Field Type Details
redirect_uri required string (uri) pattern ^https://
Example request body placeholder values
{
  "redirect_uri": "https://app.example.test/callback"
}

Responses

200 Ten-minute authorization URL, requested scopes and enrollment notice
403 Owner role required
409 Integration revoked

Example call

curl -X POST "$EHR_URL/api/v1/integrations/{id}/gmail/oauth/start" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# List reviewed Gmail outbound work

GET /api/v1/integrations/{id}/gmail/outbound-drafts

Tenant-scoped metadata for at most 100 drafts. Message bodies, attachment content, credential material and idempotency keys are omitted.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Responses

200 Draft metadata, review state and attachment count
403 Staff role required

Example call

curl "$EHR_URL/api/v1/integrations/{id}/gmail/outbound-drafts" -H "Authorization: Bearer $ACCESS_TOKEN"

# Create a reviewed Gmail message or reply draft

POST /api/v1/integrations/{id}/gmail/outbound-drafts

Creates immutable message content inside this EHR. idempotency_key must be at least 16 characters and reuse with changed content is rejected. inbox_id optionally preserves the reviewed Gmail thread, In-Reply-To and References headers. A workflow may create this draft, but only a browser-authenticated owner or clinician can separately approve and send it.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Request body application/json · required

Fields object · 10
Field Type Details
body_text required string length 1–262144
idempotency_key required string length 16–200
subject required string length 1–500
to required array of string (email) items 1–20
attachments array of object Each decoded attachment is limited to 5 MiB and the decoded aggregate to 6 MiB. items ≤ 10
data_base64 required string (byte)
filename required string length 1–200
mime_type required string length 3–100
cc array of string (email) items ≤ 20
inbox_id string or null Optional reviewed Gmail referral entry used for reply threading.
Example request body placeholder values
{
  "body_text": "This is synthetic content prepared for review.",
  "idempotency_key": "synthetic-message-0001",
  "subject": "Synthetic referral follow-up",
  "to": [
    "[email protected]"
  ],
  "attachments": [
    {
      "data_base64": "string",
      "filename": "string",
      "mime_type": "string"
    }
  ],
  "cc": [
    "[email protected]"
  ],
  "inbox_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 New immutable-content draft awaiting approval or identical idempotent replay; created indicates which
400 Invalid recipient, MIME or size bounds
409 Idempotency key reused with different content or invalid reply entry

Example call

curl -X POST "$EHR_URL/api/v1/integrations/{id}/gmail/outbound-drafts" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Open one Gmail outbound draft for review

GET /api/v1/integrations/{id}/gmail/outbound-drafts/{draft}

Returns tenant-scoped message content, attachment metadata and immutable provider receipt metadata. Attachment bytes and secrets are not returned.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
draft required path string (uuid)

Responses

200 Draft content, version, attachment metadata and optional receipt
404 Draft not found in integration

Example call

curl "$EHR_URL/api/v1/integrations/{id}/gmail/outbound-drafts/{draft}" -H "Authorization: Bearer $ACCESS_TOKEN"

# Approve, explicitly send, reconcile, or cancel a Gmail draft

POST /api/v1/integrations/{id}/gmail/outbound-drafts/{draft}/actions

Browser-authenticated owner or clinician only. approve records human review without transmitting. send is a separate action valid only at the approved expected_version and requires the gmail.send grant. An uncertain send remains needs_review and is never blindly retried. reconcile is valid only for sending or needs_review: SunCharts searches the authenticated account's Sent mail by the draft's stored RFC Message-ID and marks it sent only when exactly one matching provider message is returned. cancel is available only before sending.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
draft required path string (uuid)

Request body application/json · required

Fields object · 3
Field Type Details
action required any one of approve, send, reconcile, cancel
expected_version required integer value ≥ 1
reason required string length 1–500
Example request body placeholder values
{
  "action": "approve",
  "expected_version": 1,
  "reason": "Recipient and content reviewed against the synthetic referral."
}

Responses

200 Updated draft state and version; sent or reconciled responses include immutable Gmail receipt evidence
400 Bounded provider response or reconciliation search failure; no resend occurs
403 Owner or clinician browser session required
409 Stale version, invalid transition, missing gmail.send grant, no matching Sent message or an ambiguous match set

Example call

curl -X POST "$EHR_URL/api/v1/integrations/{id}/gmail/outbound-drafts/{draft}/actions" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# List staged Gmail referral candidates

GET /api/v1/integrations/{id}/gmail/referrals

Staff-only tenant queue, at most 100 entries. Gmail content remains unlinked until explicit human review; sender, recipients, or subject never select a patient automatically.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Responses

200 Bounded referral-review metadata and attachment counts

Example call

curl "$EHR_URL/api/v1/integrations/{id}/gmail/referrals" -H "Authorization: Bearer $ACCESS_TOKEN"

# Open one staged Gmail referral for review

GET /api/v1/integrations/{id}/gmail/referrals/{entry}

Staff-only. Returns bounded message details and attachment metadata but not OAuth credentials.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
entry required path string (uuid)

Responses

200 Tenant-scoped staged referral with attachment metadata
404 Entry not found in integration

Example call

curl "$EHR_URL/api/v1/integrations/{id}/gmail/referrals/{entry}" -H "Authorization: Bearer $ACCESS_TOKEN"

# Explicitly link or dismiss a staged Gmail referral

POST /api/v1/integrations/{id}/gmail/referrals/{entry}/actions

Staff review is mandatory. Linking requires clinical permission and an explicit tenant-scoped patient choice. This action does not create a patient, infer identity, or send an email.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)
entry required path string (uuid)

Request body application/json · required

Fields object · 3
Field Type Details
action required any one of link, dismiss
reason required string length 1–500
patient_id string (uuid) Required only for link.
Example request body placeholder values
{
  "action": "link",
  "reason": "string",
  "patient_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 Reviewed status, explicit patient link and new version
400 Unsupported action or missing patient
403 Clinical permission required to link
404 Entry or patient not found in tenant

Example call

curl -X POST "$EHR_URL/api/v1/integrations/{id}/gmail/referrals/{entry}/actions" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Request an immediate bounded Gmail synchronization

POST /api/v1/integrations/{id}/gmail/sync

Owner-only. Processes one queued Pub/Sub notification or one outbound polling cycle. A cycle reads no more than 500 messages. Each attachment is limited to 10 MiB, total attachments per message to 20 MiB, message responses to 2 MiB, and attachment responses to 14 MiB.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Responses

200 Whether a notification was processed or polling occurred
403 Owner role required

Example call

curl -X POST "$EHR_URL/api/v1/integrations/{id}/gmail/sync" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Read Gmail referral transport status

GET /api/v1/integrations/{id}/gmail/watch

Staff-visible tenant status without OAuth credentials or push verification secrets.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Responses

200 Polling or Pub/Sub watch state

Example call

curl "$EHR_URL/api/v1/integrations/{id}/gmail/watch" -H "Authorization: Bearer $ACCESS_TOKEN"

# Configure outbound polling or optional Pub/Sub

POST /api/v1/integrations/{id}/gmail/watch

Owner-only. Outbound polling is the default, runs inside the EHR, and needs no public URL or inbound firewall rule. poll_seconds must be 60 through 3600 and defaults to 300. Pub/Sub is optional and requires a Google topic, clean public HTTPS base URL, exact HTTPS OIDC audience, verified Google service-account identity and users.watch enrollment. Google OAuth verification and security-assessment requirements remain external enrollment blockers.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Request body application/json · required

Fields object · 7
Field Type Details
delivery_mode any one of poll, pubsubdefault poll
label_ids array of string items ≤ 20
oidc_audience string (uri) pattern ^https://
oidc_service_account string (email) length ≤ 320
poll_seconds integer default 300value 60–3600
public_base_url string (uri) pattern ^https://
topic_name string length ≤ 500pattern ^projects/.+/topics/.+$
Example request body placeholder values
{
  "delivery_mode": "poll",
  "label_ids": [
    "string"
  ],
  "oidc_audience": "https://app.example.test/callback",
  "oidc_service_account": "[email protected]",
  "poll_seconds": 300,
  "public_base_url": "https://app.example.test/callback",
  "topic_name": "string"
}

Responses

200 Mailbox transport configured; optional one-time push endpoint and setup requirements
400 Invalid delivery, Pub/Sub, Google profile or watch configuration
403 Owner role required

Example call

curl -X POST "$EHR_URL/api/v1/integrations/{id}/gmail/watch" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Create an expiring provider authorization intent

POST /api/v1/integrations/{id}/oauth/intents

RingCentral and Gmail only. The response intentionally has authorization_url=null until a real provider adapter constructs the official authorization URL. HealthClinics uses the EHR OAuth client and grant APIs instead.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
id required path string (uuid)

Request body application/json · required

Fields object · 2
Field Type Details
redirect_uri required string (uri) length ≤ 2000
scopes array of string items ≤ 50
Example request body placeholder values
{
  "redirect_uri": "https://app.example.test/callback",
  "scopes": [
    "string"
  ]
}

Responses

200 Ten-minute intent, one-time state and callback path; no invented provider authorization URL
400 Invalid redirect, scope or provider boundary
409 Revoked integration

Example call

curl -X POST "$EHR_URL/api/v1/integrations/{id}/oauth/intents" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json