Skip to main content
POST
Enroll a patient

Authorizations

Authorization
string
header
default:Bearer sandbox_any_token_works
required

A brand's server, one OAuth client per brand and environment. Get a token with the client_credentials grant and send it as Authorization: Bearer <token>. Tokens last 1 hour. A brand server reads status and ids only; it never reads clinical content. A platform partner holds one client for all its brands and gets one token per brand, naming it with tenant_id.

Headers

Idempotency-Key
string
required

A unique key per logical request, for example a UUID. Retrying with the same key and the same body within 24 hours returns the first response (with Idempotent-Replayed: true) instead of creating a duplicate. The same key with a different body is refused with 422 idempotency_key_reused.

Required string length: 8 - 255

Body

application/json
external_patient_id
string
required

Your patient id. It is the sub of the patient assertions you sign later.

Required string length: 1 - 128
Pattern: ^[\x21-\x7E]+$
Example:

"brand-pt-48213"

patient
object
required

What the brand already knows about the patient. Stored on the patient record for this brand only.

plan_code
enum<string>

Omit to use the brand's default plan.

Available options:
ai_only,
ai_health_fitness
Example:

"ai_health_fitness"

external_order_id
string

Your order id. Unique per brand, so a retried checkout cannot enroll twice.

Required string length: 1 - 128
Pattern: ^[\x21-\x7E]+$
Example:

"ord-2026-10-000123"

purchased_at
string<date-time>

ISO 8601 in UTC.

Example:

"2026-10-26T14:05:00Z"

intake
object

Intake answers you already collected. Keys that match a form field's prefill_from prefill onboarding forms.

Example:
consents
object[]
Maximum array length: 20
treatment
object

The medication, dose and schedule your prescriber set. TeraRx mirrors it and never changes it. Each call adds a version; the latest is the current treatment and earlier ones are the dose history.

data_sharing
boolean
default:true

Whether the care team may read this patient's logs. The patient can change it later.

Response

Enrolled.

The brand server's view of an enrollment. Status and ids only, never clinical content.

id
string<uuid>
required
Example:

"0190f5c2-3a1b-7c4d-8e9f-a0b1c2d3e4f5"

external_patient_id
string
required

Your own identifier, printable ASCII without spaces.

Required string length: 1 - 128
Pattern: ^[\x21-\x7E]+$
Example:

"brand-pt-48213"

plan_code
enum<string>
required
  • ai_only: the AI Coach only. Escalations go to the brand's prescriber as clinical flags.
  • ai_health_fitness: the AI Coach plus a health coach (nutrition) and a fitness coach.
Available options:
ai_only,
ai_health_fitness
Example:

"ai_health_fitness"

status
enum<string>
required
Available options:
pending_screening,
ineligible,
active,
paused,
cancelled,
completed
Example:

"active"

stage
enum<string>
required
Available options:
created,
awaiting_assignment,
assigned,
onboarding_pending,
onboarding_completed,
protocols_active
Example:

"onboarding_pending"

risk_level
enum<string>
required

Raised by clinical flags. Only a prescriber's resolve lowers it.

Available options:
normal,
elevated,
high
Example:

"normal"

data_sharing
boolean
required
Example:

true

created_at
string<date-time>
required

ISO 8601 in UTC.

Example:

"2026-10-26T14:05:00Z"

care_team
object[]
required

Empty on ai_only.

forms
object[]
required
protocols
object[]
required

Active protocols.

external_order_id
string | null
Example:

"ord-2026-10-000123"

purchased_at
string<date-time> | null
Example:

"2026-10-21T14:58:00Z"

assigned_at
string<date-time> | null

When the last care role was filled.

Example:

"2026-10-21T15:12:00Z"

onboarding_completed_at
string<date-time> | null
Example:

null

first_protocol_published_at
string<date-time> | null
Example:

null

last_activity_at
string<date-time> | null

Last patient activity, updated about hourly.

Example:

"2026-10-26T13:40:00Z"

ended_at
string<date-time> | null
Example:

null