03 · Consent
What this stop does
Consent confirms that the patient is present and agrees to the purpose you name. You start an authentication, embed the consent page the rail returns, and the patient completes consent on that page. The rail decides how the patient proves their identity, so your application needs no payer-specific consent logic.
Consent does not depend on a visit or a claim. You can take consent to check a cover or read a record before either exists.
Steps
- 01Start an authenticationYour backend calls POST /api/v2/patients/{unique_patient_id}/authentications and keeps the authentication_id it returns.
- 02Embed the consent pageLoad collection.url in an iframe exactly as returned, within five minutes. The patient completes consent on that page.
- 03Get the outcome on your backendThe rail POSTs the result to your callback_url. Your backend also reads the authentication until it is verified or failed.
- 04Open the visitSend the verified authentication_id as consent_ref at 04 · Visit.
Before you embed the page
- Ask the rail team to allow your origin in every environment you use. The rail loads the consent page only in frames on allowed origins, and each environment has its own list. If your origin is missing, the browser blocks the frame and your code receives no error.
- Install the hardware server on every workstation that takes fingerprints, and sign in to it. The consent page runs in a browser, which cannot reach a fingerprint reader by itself; the hardware server is the Windows application that connects the two. Your HMIS never calls it. Use the Advantage build for each environment (see below), and ask your Savannah contact for test credentials. Desks that serve Slade members need it too: Slade members are now offered a fingerprint.
- Allow extra time for a Slade member's first fingerprint consent. A member with no complete enrolment is enrolled on the consent page: both thumbs and both index fingers, each captured twice. The last capture also verifies the authentication. In environments that reserve the one-time code for members their payer has whitelisted, other Slade members are not offered a code.
- Refresh the bearer token before you start an authentication. The consent page's session ends when that token expires.
| Environment | Hardware server, Advantage build |
|---|---|
| Development | Download for development |
| Production | Download for production |
Request
Start an authentication for a patient.
authentication_id + collection.urlSend the facility in the X-Facility-Id and X-Facility-Id-Type headers, as on every rail call.
| Field | Required | Description |
|---|---|---|
purpose | Yes | Why you need consent. One of the purposes below. |
agent_id | Yes | National ID of the operator starting consent. Recorded for audit. |
callback_url | Yes | Backend URL where the rail POSTs the outcome. The rail's servers must be able to reach it. |
selection_ref | Recommended | The cover in use, from cover selection at 02. Send it so that the payer's consent rules apply. |
Response
| Field | Description |
|---|---|
authentication_id | Identifies the authentication. Store it; it becomes the consent_ref for the visit. |
status | pending until the patient completes consent. |
collection.url | The consent page to embed. It works once. |
collection.expires_at | When collection.url stops working, five minutes after issue. |
If collection is missing, the deployment could not issue a link. The authentication still
exists, so read it by id, and start a new one if you need a page to embed.
Outcome
When the authentication is verified or fails, the rail POSTs this to callback_url:
Code
A failed authentication includes error_code instead of the two timestamps. The rail sends the
callback once. It is not signed and is not retried, so confirm the result by reading the
authentication.
Read the authentication until its status is verified or failed, and stop after a timeout you
choose. An authentication the patient abandons stays pending, and no callback is sent for it.
Read an authentication.
status + expires_at| Status | Meaning |
|---|---|
pending | Consent is not complete yet. This includes an eKYC that found no fingerprints on record for an SHA member: where SHA allows it, the page moves the patient to a one-time code, and the authentication stays pending until they finish. Keep reading it. Do not start a new one. |
verified | Consent succeeded. expires_at says how long the proof can be used. |
failed | Consent did not succeed. error_detail explains why. Start a new authentication. |
Spending the proof
Send the verified authentication_id as consent_ref when you open the visit at
04 · Visit.
Purposes
| Purpose | Use |
|---|---|
eligibility_check | Confirm cover or run an eligibility search. |
cover_view | View benefit or cover details. |
visit_start | Open a visit and begin care. |
pii_access | Read a patient summary or clinical record. |
visit_end | Close a visit or discharge. |
The first four purposes can be used for one another. A proof taken for eligibility_check can open
the visit while it is still valid. visit_end is separate: only a visit_end proof can close a
visit, so start a new authentication when the patient leaves. A visit_end proof closes one visit
only: retrying the same close with it is accepted, and closing another visit with it is refused.
How long a proof lasts
- A proof is valid until
expires_at, ten minutes afterverified_at. - A fingerprint or national eKYC proof can be used more than once while it is valid. Do not ask the patient to consent again during that time.
- A one-time code proof can be used once on SHA covers, and more than once while valid on Slade covers.
- If a proof can no longer be used, opening the visit refuses it (see Errors). Start a new authentication.
What breaks here
| Where it surfaces | What the desk sees | What actually went wrong |
|---|---|---|
| Response | "The response has no collection.url" | The deployment could not issue a link, or the call had no bearer token. The authentication exists, so read it by id. |
| Frame | "The frame loads with a doubled host and never renders" | A base URL was added in front of collection.url. Use it exactly as returned. |
| Frame | "The frame is blank, or the browser says it refused to connect" | Your origin is not allowed in that environment. Ask the rail team to add it; test and production have separate lists. |
| Frame | "The link worked in a browser tab but not in the iframe" | Opening the link in the tab used it up. Start a new authentication for each attempt. |
| Workstation | "The fingerprint option cannot reach the reader on a new workstation" | The hardware server is not installed or not signed in on that workstation. Install the Advantage build and sign in. |
| Frame | "'Your session has ended' during consent" | The bearer token used to start the authentication expired. Refresh the token before starting one. |
| Outcome | "The callback never arrives" | callback_url points somewhere the rail cannot reach, such as the page that embeds the frame. Use a backend URL, and read the authentication as well. |
| Outcome | "The authentication stays pending" | The patient did not finish consent. No callback is sent. Stop polling after your timeout and start a new authentication. |
| Outcome | "We showed consent as granted and the claim was rejected for no authorisation" | The application treated the frame closing as success. Only a verified authentication shows that consent was given. |
| Slade covers | "The patient was offered different options from the payer's usual ones" | The request had no selection_ref, so the payer's consent rules did not apply. Send the selection_ref for the cover. |
| Visit | "We ask for consent twice in one visit" | The application started a new authentication while it held a valid one. Reuse the authentication_id while it is valid. |
| Discharge | "The proof from admission is refused at discharge" | Closing a visit needs a visit_end proof. Start a new authentication for it. |
Errors
Starting or reading an authentication:
| HTTP | error | When |
|---|---|---|
| 400 | AUTHN_PURPOSE_REQUIRED, AUTHN_PURPOSE_UNKNOWN | No purpose, or one that is not in the list above. |
| 400 | AUTHN_CALLBACK_REQUIRED, AUTHN_AGENT_REQUIRED | No callback_url or no agent_id. |
| 400 | FACILITY_CONTEXT_MISSING | A facility header is missing or invalid. |
| 404 | AUTHN_NOT_FOUND | No authentication with that id. |
| 409 | SELECTION_UNUSABLE | selection_ref is unknown, inactive or belongs to another patient. |
Opening a visit refuses a proof it cannot use with 409 CONSENT_NOT_REDEEMABLE, and
detail.refusal gives the reason:
detail.refusal | When |
|---|---|
AUTHN_NOT_VERIFIED | The authentication is still pending, or it failed. |
AUTHN_EXPIRED | The proof is past expires_at. |
AUTHN_CONSUMED | The proof has already been used as many times as allowed. |
AUTHN_SUBJECT_MISMATCH | The proof belongs to a different patient. |
AUTHN_PURPOSE_REFUSED | The proof's purpose does not cover this use. |
Each of these needs a new authentication.
Next
Next: 04 · Visit
A complete brief for this step — the calls to make, what to persist, and every failure path to handle. Nothing on this page is assumed.

