TrueEval is the licensed medical group and clinical operating platform behind healthcare brands. The platform underneath it exposes a real API: FHIR R4 resource endpoints, C-CDA 2.1 and full FHIR Bundle export, a versioned partner catalog contract, and HMAC-signed outbound webhooks with a written delivery guarantee. This page documents 15 endpoints — every one of them transcribed from the handler that serves it.
The base URL is issued with your API key. Paths below are shown relative to it.
The hardest question to answer honestly in this category is what happens to the clinical history if the relationship ends. TrueEval answers it with an endpoint rather than a clause. Patient records are addressable as FHIR R4, exportable as a complete FHIR Bundle, and exportable as C-CDA 2.1 XML — the format a receiving EHR ingests. Every export writes a PHI-access audit row before the bytes leave.
{ "patient_id": "<uuid>" }. Returns C-CDA 2.1 XML as application/xml with a Content-Disposition: attachment filename. Bearer JWT, and the caller-to-patient authorization is checked separately from authentication.{ "patient_id": "<uuid>" }. Returns a FHIR Bundle of type: "collection", PHI rate-limited, with an X-Export-Trace-Id response header matching the audit row.A Continuity of Care Document conforming to the US Realm Header and CCD templates (2.16.840.1.113883.10.20.22.1.1 and .1.2, extension 2015-08-01), with five sections:
| Section | templateId root |
|---|---|
| Allergies and Adverse Reactions | 2.16.840.1.113883.10.20.22.2.6.1 |
| Medications | 2.16.840.1.113883.10.20.22.2.1.1 |
| Problem List | 2.16.840.1.113883.10.20.22.2.5.1 |
| Laboratory Results | 2.16.840.1.113883.10.20.22.2.3.1 |
| Encounters | 2.16.840.1.113883.10.20.22.2.22.1 |
source: supabase/functions/generate-ccda/index.ts
export-patient-records assembles one collection Bundle across nine categories — demographics, clinical notes, medications, lab results, form responses, documents, consent records, messages and appointments — as Patient, MedicationRequest, DiagnosticReport, AllergyIntolerance, DocumentReference, QuestionnaireResponse, Consent, Communication and Appointment resources. The entry count and the category list are written into the audit event alongside the trace id.
source: supabase/functions/export-patient-records/index.ts
Six endpoints, all serving application/fhir+json. The unified endpoint declares the version and the resource set itself:
{
"resourceType": "CapabilityStatement",
"status": "active",
"fhirVersion": "4.0.1",
"format": ["json"],
"rest": [{
"mode": "server",
"resource": [
{ "type": "Patient" },
{ "type": "Observation" },
{ "type": "MedicationRequest" },
{ "type": "MedicationStatement" },
{ "type": "AllergyIntolerance" },
{ "type": "Encounter" },
{ "type": "DocumentReference" }
]
}]
}source: supabase/functions/fhir-api/index.ts
| Endpoint | Resource | Search parameters |
|---|---|---|
| fhir-api | CapabilityStatement + 7 resource typesBearer JWT. Every patient-scoped read is gated on user_has_access_to_patient() evaluated through the caller's own token, and fails closed. | /{resourceType}/{id}, ?patient= |
| fhir-patient | PatientUS Core Patient profile. Emits us-core-race, us-core-ethnicity, us-core-genderIdentity, individual-pronouns (LOINC 90778-2) and sex-parameter extensions when the source columns are populated. | ?id=, ?org_id= |
| fhir-observation | ObservationUS Core lab Observation. LOINC-coded where a test code exists; falls back to code.text. Returns up to 500, newest collection_date first. | ?patient=, ?id=, ?date= |
| fhir-condition | ConditionUS Core Condition, ICD-10-CM coded (http://hl7.org/fhir/sid/icd-10-cm), problem-list-item category. Up to 500. | ?patient=, ?id= |
| fhir-medication-request | MedicationRequestUS Core MedicationRequest. Requester is a Practitioner reference; dispenseRequest carries quantity and numberOfRepeatsAllowed. | ?patient=, ?id=, ?status= |
| fhir-document-reference | DocumentReferenceLOINC 34133-9 (Summary of episode note). include_urls=true attaches a time-limited signed URL to each attachment. | ?patient=, ?id=, ?type=, ?include_urls=true |
The five resource-specific endpoints authenticate with an API key scoped fhir:read (sent as x-api-key, or as a Bearer value), and every query is filtered to the org the key resolves to. A single-record request returns the bare resource; anything else returns a searchset Bundle. Every request — success or failure — is written to api_request_logs with the endpoint, method, status, scopes required and whether they matched.
source: supabase/functions/fhir-*/index.ts · supabase/functions/_shared/api-auth.ts
{
"resourceType": "Observation",
"id": "<uuid>",
"meta": {
"lastUpdated": "<received_at | collection_date>",
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab"
]
},
"status": "final",
"category": [{
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
"code": "laboratory",
"display": "Laboratory"
}]
}],
"code": {
"coding": [{ "system": "http://loinc.org", "code": "<LOINC>", "display": "<test name>" }],
"text": "<test name>"
},
"subject": { "reference": "Patient/<uuid>" },
"effectiveDateTime": "<collection_date>",
"valueQuantity": { "value": 0, "unit": "<result_unit>" },
"interpretation": [{
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code": "A",
"display": "Abnormal"
}]
}],
"referenceRange": [{ "text": "<reference_range>" }]
}source: supabase/functions/fhir-observation/index.ts — observationToFHIR()
{
"resourceType": "Bundle",
"id": "<uuid>",
"type": "searchset",
"total": 0,
"link": [{ "relation": "self", "url": "<endpoint>" }],
"entry": [{ "fullUrl": "<endpoint>/<id>", "resource": { } }]
}The unified fhir-api endpoint returns a FHIR OperationOutcome:
{
"resourceType": "OperationOutcome",
"issue": [{
"severity": "error",
"code": "login",
"diagnostics": "Missing authorization"
}]
}Stated precisely so nobody is surprised by it: the five resource-specific endpoints return the same application/fhir+json content type but carry a plain { "error": "<message>" } body on failure rather than an OperationOutcome. Code against both shapes. Bringing them into line is a documented, non-breaking change to the error envelope only.
Keys are 32 bytes of CSPRNG output, hex-encoded behind a te_ prefix. The plaintext is generated at the client, shown once, and never transmitted for storage — what reaches the server is a SHA-256 hash plus the first ten characters as a lookup prefix. TrueEval cannot recover your key, which is the whole point of storing it that way.
x-api-key: te_<64 hex chars>Validation returns the key's org_id and every handler filters its query to it. A child-org key that tries to override ?org_id to a different org gets a 403.
Scopes live in permissions.scopes on the key. The FHIR gate accepts the exact scope, fhir:*, or *, and rejects everything else.
expires_at is checked on every validation, and is_active=false takes a key out immediately. last_used_at is written on each successful call.
Keys carry rotated_from and overlap_until, so a replacement can be issued and cut over before the old key stops working.
| Scope | Grants |
|---|---|
| intake:write | Submit patient intake data |
| patients:read | Read patient records |
| patients:write | Create/update patients |
| appointments:read | Read appointments |
| appointments:write | Create appointments |
| labs:read | Read lab results and kit status |
| labs:write | Dispatch lab kits, submit lab results |
| notes:read | Read clinical chart notes |
| prescriptions:read | Read prescription status |
| prescriptions:write | Create prescriptions |
| billing:read | Read billing and charge data |
| billing:write | Create charges and payments |
| queue:read | View visit queue |
| queue:write | Create queue items |
| webhooks:manage | Manage webhook config |
| fhir:read | Read the FHIR R4 resource endpoints. fhir:* and * also satisfy the gate. |
Each key also carries rate_limit_rpm, which defaults to 60 requests per minute at issue. Exceeding it returns 429.
source: supabase/functions/_shared/api-auth.ts · create-api-key/index.ts · list-api-keys/index.ts · src/components/api-docs/ApiKeyManager.tsx
org_id, name, key_hash, key_prefix, permissions, rate_limit_rpm. Returns { "id": "<uuid>" }.{ "org_id": "<uuid>" }. Returns key metadata only — id, name, key_prefix, permissions, rate_limit_rpm, is_active, created_at, last_used_at, overlap_until, rotated_from. Never the key.A storefront reads the catalog, hands intake off after checkout, and polls status. Three endpoints cover it, and the contract they implement is versioned with its change history recorded in the handler.
contract_version: "v1.7". Served with Cache-Control: public, max-age=60, so a pricing change made in the admin UI is visible to a storefront inside a minute with no cron and no local mirror. Authenticate with x-api-key (the key resolves its own org) or pass org_id; neither is a 400.201. Idempotent on external_order_id / external_reference within an org.external_order_id.?external_patient_id=. Returns the patient's current visit, billing, prescriptions, lab kits and event timeline. Verbosity follows the org's configured detail level — minimal returns four base fields only, standard adds operational detail, detailed adds protected fields.The catalog endpoint answers unauthenticated reads by design, because patient-facing prices are meant to be public. Wholesale cost and computed margin are not. redactCostBasis removes floor_cost_cents, mso_margin_cents and affiliate_margin_cents from a deep copy before any anonymous response is serialized — at both success exits, and after the snapshot cache rather than before it, so a cached payload can never leak fields the fresh path strips. API-key holders still receive them, because the contract owes them. A field that happens to be null and a field that is redacted look identical in a probe and are not the same guarantee.
source: supabase/functions/_shared/catalog-redaction.ts
{
"org": { "id": "<uuid>", "slug": "<slug>", "name": "<display name>" },
"updated_at": "<ISO 8601>",
"contract_version": "v1.7",
"programs": [{
"id": "<uuid>",
"program_id": "<uuid>",
"slug": "<slug>",
"name": "<display name>",
"description": "<resolved from program, falling back to root protocol>",
"patient_facing_summary": "<long-form>",
"marketing_hero_subtitle": "<one-liner>",
"category": "<service_line>",
"modality": "<modality_policy>",
"modality_policy": "<modality_policy>",
"renewal_mode": "<renewal_mode>",
"patient_price_cents": 0,
"floor_cost_cents": 0,
"mso_margin_cents": 0,
"affiliate_margin_cents": 0,
"pricing_strategy": "margin_pct | flat_dollar | pass_through",
"source": "mso_treatment_pricing | no_wholesale_on_file",
"is_active": true,
"show_on_marketing_site": true,
"duration_days": 30,
"includes_medication": true,
"includes_lab": false,
"lab_panel_included": null
}],
"protocols": [{
"id": "<uuid>",
"slug": "<slug>",
"name": "<display name>",
"description": "<clinical description>",
"category": "<legacy taxonomy>",
"marketing_category": "<8-value enum>",
"patient_facing_summary": "<long-form>",
"marketing_hero_subtitle": "<one-liner>",
"duration_days": 30,
"is_active": true,
"show_on_marketing_site": true,
"is_visit_only": false,
"is_controlled": false,
"requires_dea": false,
"requires_sync_modality": false,
"patient_price_cents": 0,
"floor_cost_cents": 0,
"mso_margin_cents": 0,
"pricing_strategy": "margin_pct",
"tier_count": 0,
"source": "protocol_pricing | tier_pricing_only | no_pricing_on_file",
"updated_at": "<ISO 8601>",
"labs_required": { "baseline": true, "ongoing": false, "max_age_days": 90 },
"lab_panel": {
"display_name": "<panel>",
"gender": "<gender>",
"biomarkers": [],
"biomarker_count": 0,
"fasting_required": false,
"turnaround_days": 0,
"collection_type": "<collection_type>",
"lab_partner": "TrueLabs"
}
}],
"platform_features": [{
"feature_key": "...",
"title": "...",
"description": "...",
"icon_slug": "...",
"display_order": 0
}]
}source: supabase/functions/api-treatment-catalog/index.ts · INTEGRATION-CONTRACT.md
{
"success": true,
"patient_id": "<uuid>",
"queue_item_id": "<uuid>",
"queue_item_ids": ["<uuid>"],
"cart_size": 1,
"intake_link": "<url>",
"intake_url": "<url>",
"portal_url": "<url>",
"intake_link_2": "<url>",
"intake_url_2": "<url>",
"checkout_url": "<url>",
"magic_link_url": "<url | null>",
"checkout_magic_link": "<url | null>",
"status": "<queue item status>",
"payment_required": false
}treatment_type must be a canonical protocol slug drawn from protocols[] in the catalog; treatment_protocol_ids[] carries the full cart, primary first. Protocol ids are validated against the live catalog before any patient row is created, so a stale snapshot fails fast with the offending ids echoed back rather than creating a half-formed record.
source: supabase/functions/api-patient-intake/index.ts
Subscribe an HTTPS endpoint, pick the events you want, and receive a signed envelope. One builder produces the wire body for both live deliveries and test pings, so a receiver that parses the test parses production.
{
"id": "<uuid>",
"timestamp": "<ISO 8601>",
"event": "prescription.dispatched",
"entity_type": "prescription",
"entity_id": "<uuid>",
"org_id": "<uuid>",
"data": { }
}source: supabase/functions/_shared/webhook-delivery-body.ts
| Event | Fires when |
|---|---|
| chart_review.completed | A provider finalizes a chart. |
| visit.completed | A visit is finalized. |
| patient.intake_started | A patient begins intake. |
| patient.intake_completed | Intake forms are done. |
| prescription.dispatched | An Rx is routed to a pharmacy. |
| lab_kit.shipped | A lab kit ships to the patient. |
| lab_kit.delivered | A lab kit is delivered. |
| lab_results.available | Lab results are ready. |
| payment.collected | A payment succeeds. |
| payment.failed | A payment attempt fails. |
Billing integrations can additionally receive commission.settled and commission.reversed, and webhook.test is the ping event. A subscription only receives the events it lists, scoped to its own org — an event for one org can never be delivered to another org's endpoint.
source: src/components/api-docs/WebhookConfig.tsx · supabase/functions/_shared/webhook-emit.ts
Content-Type: application/json
X-Webhook-ID: <delivery uuid>
X-Webhook-Signature: sha256=<hmac>
X-Idempotency-Key: <outbox row id> # stable across retries of one row
X-Event-Id: <sha256 hex> # stable per LOGICAL event
X-Event-Sequence: <epoch micros> # monotonic per destination
User-Agent: Healthcare-Webhook/1.0// lowercase-hex HMAC-SHA256 of the RAW JSON body string,
// keyed by the subscription secret. Compare against the value
// after "sha256=" in X-Webhook-Signature.
const key = await crypto.subtle.importKey(
"raw",
new TextEncoder().encode(secret),
{ name: "HMAC", hash: "SHA-256" },
false,
["sign"],
);
const signature = await crypto.subtle.sign(
"HMAC", key, new TextEncoder().encode(rawBody),
);
const hex = Array.from(new Uint8Array(signature))
.map((b) => b.toString(16).padStart(2, "0"))
.join("");source: supabase/functions/_shared/webhook-sign.ts
created_at order, ties broken deterministically.X-Idempotency-Key (stable per outbox row) or X-Event-Id (stable per logical event).https:// URL; a 3xx surfaces as a failed delivery rather than being chased, because a public URL redirecting to an internal address would defeat the SSRF guard.source: supabase/functions/webhook-deliver/index.ts · supabase/functions/_shared/webhook-delivery-policy.ts
{ "org_id": "<uuid>" }, optionally with "event": "commission.settled". Loads your own subscription, signs a test envelope with your own secret, POSTs it to your real endpoint, and returns { ok, delivered, status, endpoint, response_body, message } carrying the live HTTP status your receiver gave. It exercises the rail real events use, not a parallel one — a green ping means production traffic arrives the same way.source: supabase/functions/send-test-webhook/index.ts
The partner contract is versioned and every response carries its version in contract_version. The change history is recorded in the handler itself rather than in a changelog that can drift from it — v1.4 added the protocol layer alongside programs, v1.5 added the labs_required and lab_panel blocks, v1.6 white-labelled lab_panel, and v1.7 made a single enablement toggle the sole gate on storefront visibility.
data at any v1.x bump, so parse defensively.labs_required and protocols[] shipped that way, with programs[] preserved unchanged for back-compat.source: INTEGRATION-CONTRACT.md · supabase/functions/api-treatment-catalog/index.ts
| HTTP | error | Meaning |
|---|---|---|
| 401 | Invalid API key | The key hash matched nothing active, or the key was never sent. |
| 401 | API key has expired | expires_at is in the past. |
| 403 | Missing required scope: <scope> | The key is valid but its permissions.scopes array does not include the scope this endpoint requires, nor a fhir:* or * wildcard. |
| 403 | api key does not have access to requested org_id | A child-org key attempted to override ?org_id to a different org. |
| 400 | x-api-key header or org_id query parameter required | The catalog endpoint could not resolve an org. |
| 400 | invalid_uuid | A request field carried a malformed UUID. Returned as a caller error, never as a 500. |
| 400 | protocol_required | treatment_type / treatment_slug did not resolve to a protocol with a default_protocol_id. Re-fetch the catalog. |
| 400 | invalid_protocol_ids | One or more treatment_protocol_ids do not exist. Body echoes the offending ids. You are on a stale catalog snapshot. |
| 400 | disabled_protocol_ids | The ids exist but are flagged is_active=false. Stop selling them and re-fetch. |
| 400 | service_line_unresolved | The resolved program carries no service_line, so intake dedup cannot be keyed. Fails loud rather than mis-bucketing. |
| 409 | Duplicate request | Same patient and treatment within five minutes. |
| 429 | Rate limit exceeded | Above the key's rate_limit_rpm. |
Non-FHIR endpoints return { "error": "<code>", "message": "<detail>" } as application/json. Where a validation failure names specific inputs, the offending values are echoed back — an invalid_protocol_ids response lists exactly which ids failed, so the fix is mechanical rather than a support thread.
Everything above is the shape of a contract that exists, transcribed from the code that serves it. Some things a developer might reasonably expect on a page like this are missing on purpose:
Take the assessment to see how this regulatory change impacts your specific business and where you're exposed.
What the medical group supplies behind your own front end, what you keep, and the two partnership structures.
For platforms and brandsWhat the clinical operating platform runs day to day, above the API.
See the platformScoped keys, a webhook subscription, and the base URL are issued during onboarding.
Talk to usTake the assessment to see how this regulatory change impacts your specific business and where you're exposed.