In short
- One call links a visit to the patient’s ABHA address as a care context.
- Send the FHIR bundle in
dataif Eka stores the record; leave it out if you keep it. - The call returns
202; the result arrives onabha.link_care_context. LINKEDmeans the record is shareable; onERRORED, readdata.error.
When to use this
A patient with an ABHA has finished a visit, test or admission at your facility. You want that record linked to their ABHA address as a care context. Once linked, the care context is registered with ABDM and any Health Information User (HIU) the patient grants consent to can request it. Before you link, decide one thing: does Eka store the clinical data, or do you? If Eka stores it, you send the FHIR bundle with the link call and Eka answers every later data request for you. If you keep it, you leave the bundle out and answer each request yourself with Serve records on a fetch request. For records created before the patient’s ABHA was known, the patient claims them from a PHR app instead. See Answer discovery and link old records.Before you start
- A client access token, sent as a Bearer token. See Authorization.
- Your facility onboarded as a Health Information Provider (HIP), with its HIP ID. See Milestone 4.
- A webhook URL registered with Eka that can receive
abha.link_care_context, and the means to verify the webhook signature. - The patient’s
abha_addressand Eka user idoid, saved on the patient record. They come from Create an ABHA with Aadhaar OTP or Log in to an existing ABHA. - Your own id for the care context, its display name and its health information type (
hi_type, for exampleOPConsultationorPrescription). - If Eka is to store the data: the ABDM-compliant FHIR bundle for the care context.
Sequence
Steps
1
Link the care context
Call Care context linking. Send the patient’s
oid in the X-Pt-Id header, your patient id in X-Partner-Pt-Id and your HIP ID in X-Hip-Id. In the body, send abha_address, oid, partner_user_id and one entry in care_contexts per record, each with care_context_id, display and hi_type.Decide on the data now. If Eka stores the data, put the base64-encoded FHIR bundle in each entry’s data field and list its health information types in hi_types. Eka then answers data requests for you, and you never receive abha.hip_data_fetch for this care context. If you keep the data, leave data out and run Serve records on a fetch request whenever a request arrives.The call returns 202 Accepted. That means Eka has taken the request, not that the care context is linked.2
Wait for the linking status
Eka sends the
abha.link_care_context webhook with the result. Acknowledge it with HTTP 200 within 5 seconds; Eka retries on any other status.Read data.status. If it is LINKED, mark the care context as linked on your side; it is now discoverable and shareable. If it is ERRORED, read data.error for the reason. data.retry_count reports how many times linking was retried.Match the webhook to your record by data.care_context_id.3
Notify the patient (optional)
Call Notify unlinked care contexts with the patient’s 10-digit
mobile_number. It notifies the gateway that a new health record is ready to be shared with the patient. It returns 202 Accepted.State you must persist
When it fails
Error responses carrycode, error and source_error. The codes below are from the errors page; match the one you receive there.
Test it
The testing page has the sandbox base URL, credentials and the happy path for every journey.- Link one
OPConsultationcare context withdataset, and receiveabha.link_care_contextwithstatusLINKED - Link one care context without
data, receiveLINKED, then confirm a later consent request arrives asabha.hip_data_fetch - Send an invalid
abha_addressand check the error response - Return a non-
200from your webhook once and confirm Eka retries

