In short
- Use this only if you link care contexts without sending their FHIR data to Eka.
- Eka sends
abha.hip_data_fetch; acknowledge it within 5 seconds. - Encrypt each bundle for the HIU, then push it with on-fetch.
- Send back the
transaction_idfrom the webhook.
When to use this
You linked care contexts without sending their FHIR data to Eka, so you hold the records yourself. When a Health Information User (HIU) requests those records after the patient grants consent, Eka sends you a webhook. You build the FHIR bundles, encrypt them for the HIU, and push them back. Eka serves the data itself, and you never receive this webhook, in two cases:- You send the base64 FHIR bundle in the
datafield when you link a care context. - You upload records through the Upload API.
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.
- Care contexts linked without
data, through Link a care context as a HIP or Answer discovery and link old records. - A webhook URL registered with Eka that can receive
abha.hip_data_fetch, and the means to verify the webhook signature. - A way to produce an ABDM-compliant FHIR bundle for each care context you linked.
- A choice of how to encrypt: the open-source
abdm-ecdhlibrary in your own code, described in Encryption, or Eka’s ECDH endpoints. The library keeps your private key on your server. The Ecdh encrypt endpoint takes your private key in the request body.
Sequence
If you use theabdm-ecdh library, the two /abdm/v1/ecdh/ calls run in your own code instead. Encryption shows the library’s calls and their outputs.
Steps
1
Receive the fetch request
Eka sends the
abha.hip_data_fetch webhook. Acknowledge it with HTTP 200 within 5 seconds; Eka retries on any other status. Do the rest of the work after you acknowledge.From data, keep:care_contexts: the ids of the care contexts to send, the same ids you linked.hi_types: the health information types the HIU asked for.key_information: the HIU’s key material. You needdh_public_key.key_value,dh_public_key.expiryandnonce.transaction_id: you send it back in the push.abha_address,oid,partner_patient_idandhip_id: to find the patient and for the push headers.
2
Generate your key material
Call Ecdh keys. The response carries
private_key, public_key and nonce for your side of the exchange.3
Encrypt each care context's bundle
Build the FHIR bundle for each id in
care_contexts. Call Ecdh encrypt once per bundle with:plain_text_data: the FHIR bundle as a string.sender_private_key,sender_public_key,sender_nonce: your key material from the previous step.receiver_public_key:key_information.dh_public_key.key_valuefrom the webhook.receiver_nonce:key_information.noncefrom the webhook.
encrypted_data and key_to_share.Compute a checksum of the plain-text bundle before you encrypt it; the push needs it.4
Push the encrypted data
Call Push care context data to HIU. Send the patient’s
oid in X-Pt-Id, your patient id in X-Partner-Pt-Id and your HIP ID in X-Hip-Id. In the body send:transaction_idfrom the webhook.entries: one per care context, each withcare_context_id,contentset toencrypted_data,mediaset toapplication/fhir+json, andchecksum.key_information: your side of the exchange, withcrypto_algECDH,curveCurve25519,dh_public_key(key_value,expiry,parameters) andnonceset to yournonce.page_numberandpage_count.
202 Accepted.State you must persist
When it fails
Error responses carrycode, error and source_error.
Test it
The testing page has the sandbox base URL, credentials and the happy path for every journey.- Link a care context without
data, then raise a consent request for it from a sandbox HIU and receiveabha.hip_data_fetch - Encrypt one bundle with
GET /abdm/v1/ecdh/keysandPOST /abdm/v1/ecdh/encrypt, push it, and get202 Accepted - Repeat with the
abdm-ecdhlibrary and compare the result - Round-trip the library on its own first: generate two key sets,
encryptwith one,decryptwith the other, as in Encryption - Return a non-
200from your webhook once and confirm Eka retries

