API calls
API calls, at a glance
Every call in this table is live in production today and documented in the API reference.
The four calls that carry a customer through signup
Four payloads, matching steps 1, 3, 5 and 6a of the first-order diagram. Host tokens resolve to the environment you are reading this on; sandbox and production hosts are listed in Before you begin.
Step 1: Start the journey
That is the whole of the customer information Truemed needs, and each field does one job:
customer_email: required. Truemed uses it to create the patient record the LMN is written for, and it is where the receipt goes. It is not how you look the customer up afterwards; that is the token’s job, and the distinction matters, because an email address can change while the person does not.customer_name: required. It goes on the LMN, and it pre-fills the name confirmation step in the survey so the customer confirms rather than retypes. It is read once, when the record is first created, so a later name change on your side does not travel through this call.customer_state: optional, and worth sending. It pre-fills the state-of-residence answer, which determines which practitioner can review the case. It is the only survey answer this call can pre-fill.metadata: an opaque string Truemed stores and hands back to you on the token webhook and on every payment session. This is where your own customer ID goes. There is no dedicated external-ID field on this endpoint today; if you would rather have a first-class one, say so and we will scope it.order_items: deliberately absent. Your channel qualifies against the whole catalog, so there is no basket to declare. (For other partners it is required.)use_iframe:true, which is what makes the returned URL embeddable. See Embedding the flow.
Step 2: Read what comes back
Use redirect_url as the src of your iframe. That is step 2 of the first-order flow, the health survey
and the two cards, rendered inside a modal on your page.
Persist provision_token_request_id on the customer record before you open the frame. It is the
join key. The decision comes back asynchronously, minutes or hours later, on a webhook that carries no
email and no name, so this id (or your own id inside metadata) is how you know which customer it
belongs to.
Step 3: Receive the token
Acknowledge with a 2xx; Truemed retries with backoff for up to seven days. The payload is a full
snapshot of current state rather than a delta, so the safe way to consume it is to upsert, overwriting
the token and card details you hold. That stays correct under a retry and under a genuine later update
alike.
payment_token: the value you charge against. Its shape istm_token_<uuid4>, 45 characters; treat it as an opaque string rather than parsing it. It is the only field on this payload guaranteed to be non-null.eligibility_status: the clinical outcome, one ofapproved,pending,expired,rejectedornever_requested. On a first order it isapprovedorrejected. The other three can reach you on a later delivery for the same token, so branch on the value rather than treating it as a boolean. It is an additive optional field, so a handler written before it existed keeps working unchanged.payment_methods: last four and expiry for both stored cards, HSA/FSA first, so you can render “HSA •••• 4242 · regular •••• 1881” in account settings without a second call.lmn_expires_at: the 12-month LMN expiry described in Subsequent orders. It is the same date you get back on every payment session.- The envelope shown is what a signed endpoint receives, with an HMAC-SHA256 over the timestamp and
body in
x-truemed-signature. We recommend it. An endpoint registered without a signing secret instead receives the innerdataobject at the top level, authenticated withx-truemed-api-key.
The rejected delivery is the same event, and three fields tell it apart. It is worth having side by side with the payload above:
The token is still minted, so the outcome can be correlated back to the provision_token_request_id
you persisted. It simply covers nothing, and every line of every charge routes to the regular card.
Where the token lives on your side
One token per customer, stored as a field on the customer or subscription record, in the same place you would keep a payment-method id. It is what every later create payment session call is keyed on, including the unattended weekly ones, so it needs to be readable from your recurring-billing job as well as from a checkout session.
Two properties are worth designing around. The token is long-lived and writable: if the customer
later replaces a card, the token value stays the same and Truemed sends payment_token.updated again,
with the same payment_token, the same provision_token_request_id and refreshed payment_methods. So
handle a repeat delivery as an update to the record you already have. The token is also durable: it
survives LMN expiry. An expired LMN leaves the token valid and means the HSA/FSA portion stops
being eligible, so everything routes to the regular card until a new LMN is in place.
Step 4: Read eligibility, before and after the decision
Retrieve Eligibility by Provision Request:
This is the read behind step 3 of the first-order flow. The LMN is still with the practitioner, so
items is what the survey predicts it will cover and there is no expiry yet. Badge these as provisional.
The charge still waits for step 5’s webhook.
This is the same one call whether or not a person picks the meals. If the customer chooses their first box by hand, you use the response to badge the menu they are looking at. If your personalization engine assembles the box for them with no manual selection, you use the identical response to decide which lines are HSA/FSA-payable before you charge. The eligibility call answers the same question in both cases.
Once the token is minted, the same read keyed on the token answers with the decided coverage. This is the call every later order opens with:
If the practitioner declines, the same read answers rejected, the same value the webhook already
carried, available here whenever you want to confirm it:
The token still arrives on payment_token.updated with zero HSA/FSA coverage, so the held order charges
fully to the regular card and ships. Use this outcome for messaging.
All three forms are live and share one response shape. Called bare, as
GET /api/v1/eligibility with no key, it
returns your whole configured catalog with eligibility_status and lmn_expires_at both null: the
menu-with-no-customer read. The
state table
below spells out items and lmn_expires_at for every value.
Five states, five different things to do
Every form of GET /api/v1/eligibility, whether bare, keyed on /token/{token_id}, or keyed on
/provision_request/{provision_token_request_id}, answers with the same three-field response shape:
eligibility_status, items, lmn_expires_at. The field tells you where the customer stands, and you
decide what your lifecycle messaging does about it. First, what each value carries:
The bare catalog read, GET /api/v1/eligibility with no key, returns every item configured for you with
eligibility_status and lmn_expires_at both null: there is no shopper to have either.
The states are not interchangeable, and one of them is a reason to hold back:
Never requested is usually yours to know without asking, though not always. The read is keyed on
ids only you hold: the token, or the provision-request id for the first order. If you are holding
neither for a customer, they have never started the journey, and there is nothing to call. What that
reasoning misses is that a customer can hold a token while no LMN was ever requested for them, so
holding an id is not proof that a decision was ever made. When you call the read in that situation,
Truemed answers never_requested rather than folding the case into expired, which would assert a
an LMN that never existed and point you at a renewal nudge when what the customer needs is a first-time
prompt.
Rejected is the one worth handling carefully. A customer whose LMN lapsed, who requalified and was
then declined, still has a live token and a working regular card, so everything keeps shipping and keeps
charging. What should not happen is another renewal nudge: a practitioner has already reviewed and
declined, and Truemed has already emailed them about it. Reading eligibility_status, rather than
inferring from an empty items list, is what keeps you from asking twice. A first-order rejection lands
in the same place from day zero: the token arrives covering nothing, and the subscription starts on the
regular card instead of dying at the gate.