Records & Consents
Discover records from a PHR app, support deep links, manage consent, and upload records to a locker.
A PHR app lets the patient discover, link, fetch, view, and upload health records. It also lets the patient manage consent requests from HIUs.
Use this page for the PHR-side flow. Use Milestone 2 for the HIP-side discovery and data transfer logic.
Confirm exact schemas
The source has OCR for some API screenshots. The examples below use the referenced v3 Swagger paths. Verify the exact payload before sandbox exit.
User-initiated discovery
Use user-initiated discovery when the patient did not share an ABHA address at the facility. The patient searches a facility or a health programme. The PHR app sends the patient identifiers to HIE-CM. HIE-CM forwards the request to the HIP.
sequenceDiagram participant Patient participant App as PHR app participant CM as HIE-CM participant HIP Patient->>App: Search facility or programme App->>CM: POST patient/care-context/discover CM->>HIP: POST callback /patient/care-context/discover HIP-->>CM: POST on-discover CM-->>App: POST callback /patient/care-context/on-discover Patient->>App: Select care context entries App->>CM: POST link/care-context/init CM->>HIP: POST callback /link/care-context/init HIP-->>Patient: Send OTP Patient->>App: Enter OTP App->>CM: POST link/care-context/confirm CM->>HIP: POST callback /link/care-context/confirm HIP-->>CM: POST on-confirm CM-->>App: Link success
Search the provider
Let the patient search an ABDM-compliant facility or programme. Examples include CoWIN, AB-PMJAY, eSanjeevani OPD, eSanjeevani HWC, and RCH.
Show patient details
Show the details that the PHR app will share. Ask for an optional patient ID only when the provider needs it.
| Field | Required |
|---|---|
| Verified mobile number | Yes |
| ABHA address | Yes |
| ABHA number | If available |
| Full name | Yes |
| Year of birth | Yes |
| Gender | Yes |
| Patient ID or programme ID | Optional |
Discover care context entries
curl -X POST "https://dev.abdm.gov.in/api/hiecm/user-initiated-linking/v3/patient/care-context/discover" \
-H "Content-Type: application/json" \
-H "REQUEST-ID: $(uuidgen | tr 'A-Z' 'a-z')" \
-H "TIMESTAMP: $(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
-H "X-CM-ID: sbx" \
-H "Authorization: Bearer <hiecm-access-token>" \
-d '{
"hip": {
"id": "HIP_1"
},
"unverifiedIdentifiers": [
{
"type": "ABHA_ADDRESS",
"value": "john.doe@sbx"
},
{
"type": "MOBILE",
"value": "9876543210"
},
{
"type": "MR",
"value": "123456"
}
]
}'{
"status": "ACCEPTED"
}Link selected records
Show only unlinked care context entries. If all records already link, show a clear message.
curl -X POST "https://dev.abdm.gov.in/api/hiecm/user-initiated-linking/v3/link/care-context/init" \
-H "Content-Type: application/json" \
-H "REQUEST-ID: $(uuidgen | tr 'A-Z' 'a-z')" \
-H "TIMESTAMP: $(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
-H "X-CM-ID: sbx" \
-H "Authorization: Bearer <hiecm-access-token>" \
-d '{
"transactionId": "2ec11b33-9a2d-4c8a-96a0-4b0d1fd5f511",
"patient": [
{
"referenceNumber": "P12345",
"display": "John Doe",
"careContexts": [
{
"referenceNumber": "VISIT-2026-001",
"display": "OP visit on 11 Aug 2026"
}
],
"hiType": "OPConsultation",
"count": 1
}
]
}'{
"linkRefNumber": "link-ref-123",
"status": "INITIATED"
}Confirm with OTP
The HIP sends the OTP to the patient mobile number. Confirm the link with the token and link reference.
curl -X POST "https://dev.abdm.gov.in/api/hiecm/user-initiated-linking/v3/link/care-context/confirm" \
-H "Content-Type: application/json" \
-H "REQUEST-ID: $(uuidgen | tr 'A-Z' 'a-z')" \
-H "TIMESTAMP: $(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
-H "X-CM-ID: sbx" \
-H "Authorization: Bearer <hiecm-access-token>" \
-d '{
"token": 123456,
"linkRefNumber": "link-ref-123"
}'{
"status": "ACCEPTED"
}Discovery error states
| State | Message to show |
|---|---|
| HIP not reachable | “Could not connect. Please try again later.” |
| No match | “No health records found.” |
| All records linked | “No new health record to link.” |
| Fetch takes time | “Recently linked records might take some time to show.” |
After a successful link, show the provider in the Linked Facility tab. Send the data transfer request within 5 minutes after the patient taps Pull Records. Expect fetched records to appear within 2 hours.
Deep links
A facility can notify ABDM when it creates a record for a patient without an ABHA address.
ABDM sends an SMS with a deep link such as phr.abdm.gov.in/uhi/<hipcode>.
The deep link page lists approved PHR apps.
The PHR app must receive the HIPCODE parameter. It must bypass the normal home flow and start discovery automatically.
New user flow
Open the deep link
Show the approved PHR app list for the phone operating system. Randomize the app order as ABDM requires.
Install and register
Route the patient to the store if the selected app is not installed. After install, help the patient create an ABHA address.
Start discovery
Start discovery with the HIPCODE from the deep link. Ask the patient to enter the same name, DOB, gender, and mobile number used at the facility.
Existing user flow
Launch the app
Open the installed PHR app from the deep link.
Authenticate if required
Ask for login if the patient session expired.
Start discovery
Use the HIPCODE and show matched care context entries. Then let the patient link and fetch records.
Sandbox exit details
Submit these details for deep link support:
| Required detail | Example |
|---|---|
| Application name | Aarogya Setu |
| Play Store URL | https://play.google.com/store/apps/details?id=nic.goi.aarogyasetu |
| App Store URL | https://apps.apple.com/in/app/aarogyasetu/id1505825357 |
| HIPCODE support | The app must parse and process the HIPCODE parameter. |
Consent management
The PHR app is the patient interface for consent. It must support view, modify, grant, deny, active consent view, and revoke.
flowchart TD
A[Consent request received] --> B[Show request to patient]
B --> C{Patient action}
C -->|Modify| D[Update parameters]
D --> C
C -->|Grant| E[Approve request]
C -->|Deny| F[Deny request]
E --> G[Show in active consents]
G --> H[Revoke when patient asks]
H --> I[Update HIE-CM status]
View consent requests
Show the requester, purpose, HI types, date range, consent validity, and status.
curl -X GET "https://dev.abdm.gov.in/api/hiecm/consent/v3/request" \
-H "REQUEST-ID: $(uuidgen | tr 'A-Z' 'a-z')" \
-H "TIMESTAMP: $(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
-H "X-CM-ID: sbx" \
-H "Authorization: Bearer <hiecm-access-token>"{
"requests": [
{
"requestId": "consent-req-123",
"status": "REQUESTED",
"purpose": "Care Management",
"hiTypes": ["DiagnosticReport", "Prescription"]
}
]
}Modify before grant
Allow changes only where the request permits them. Let the patient adjust the date range, HI types, frequency, expiry, and access mode.
Grant consent
curl -X POST "https://dev.abdm.gov.in/api/hiecm/consent/v3/request/<request-id>/approve" \
-H "Content-Type: application/json" \
-H "REQUEST-ID: $(uuidgen | tr 'A-Z' 'a-z')" \
-H "TIMESTAMP: $(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
-H "X-CM-ID: sbx" \
-H "Authorization: Bearer <hiecm-access-token>" \
-d '{
"consents": [
{
"hiTypes": ["DiagnosticReport", "Prescription"],
"hip": {
"id": "HIP_1",
"name": "Example Hospital",
"type": "HIP"
},
"careContexts": [
{
"patientReference": "P12345",
"careContextReference": "VISIT-2026-001"
}
],
"permission": {
"dateRange": {
"from": "2026-01-01T00:00:00.000Z",
"to": "2026-08-11T00:00:00.000Z"
},
"frequency": {
"unit": "HOUR",
"value": 1,
"repeats": 0
},
"accessMode": "VIEW",
"dataEraseAt": "2026-09-11T00:00:00.000Z"
}
}
]
}'{
"status": "ACCEPTED"
}Deny consent
curl -X POST "https://dev.abdm.gov.in/api/hiecm/consent/v3/request/<request-id>/deny" \
-H "Content-Type: application/json" \
-H "REQUEST-ID: $(uuidgen | tr 'A-Z' 'a-z')" \
-H "TIMESTAMP: $(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
-H "X-CM-ID: sbx" \
-H "Authorization: Bearer <hiecm-access-token>" \
-d '{
"reason": "Patient denied the consent request"
}'{
"status": "ACCEPTED"
}View active consents
Show granted, expired, and revoked consents in the Approved section. Show which HIU can access which records.
Revoke consent
Warn the patient before revocation. Tell the patient that ABDM access will stop.
curl -X POST "https://dev.abdm.gov.in/api/hiecm/consent/v3/revoke" \
-H "Content-Type: application/json" \
-H "REQUEST-ID: $(uuidgen | tr 'A-Z' 'a-z')" \
-H "TIMESTAMP: $(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
-H "X-CM-ID: sbx" \
-H "Authorization: Bearer <hiecm-access-token>" \
-d '{
"consents": ["consent-artefact-123"]
}'{
"status": "ACCEPTED"
}Fetch and display records
A PHR app also acts as an HIU. After a care context link, create a consent request. Use auto-approve if the patient configured it. Then fetch records with the approved consent artefact.
| Step | Requirement |
|---|---|
| Notification | Receive the new care context notification. |
| Consent | Create a consent request for the linked record. |
| Fetch | Initiate a health information request. |
| Store | Store the fetched record securely. |
| Display | Show records in chronological order. |
| Purge | Follow ABDM privacy and consent rules. |
See Milestone 3 for the HIU data request flow.
Upload records to a locker
The PHR app must let the patient scan or upload records. Examples include paper records, BP meter output, glucose meter output, and smartwatch records.
Use the selected or detected HI type.
Use HealthDocumentRecord when the app cannot identify the HI type.
The PHR app must get a linking token for the ABHA address. Then it must add the uploaded item as a care context through HIP initiated linking. See Milestone 1 for linking tokens. Use Milestone 2 to share uploaded records through ABDM.
curl -X POST "https://dev.abdm.gov.in/api/hiecm/subscription-requests/v3/setup-locker" \
-H "Content-Type: application/json" \
-H "REQUEST-ID: $(uuidgen | tr 'A-Z' 'a-z')" \
-H "TIMESTAMP: $(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
-H "X-CM-ID: sbx" \
-H "Authorization: Bearer <hiecm-access-token>" \
-d '{
"patient": {
"id": "john.doe@sbx"
},
"locker": {
"id": "PHR_LOCKER_ID",
"name": "Example PHR Locker"
}
}'{
"lockerId": "PHR_LOCKER_ID",
"status": "ACTIVE"
}Locker setup body is uncertain
The archived source shows only the locker endpoint path. Treat this request body as an implementation sketch. Use the latest subscription Swagger for the exact body.
Upload UX checks
| Check | Requirement |
|---|---|
| File type | Accept JPG, PNG, and PDF. |
| File size | Keep each file within 10 MB. |
| Page limit | Keep each file within 40 pages. |
| Ownership | Tell the patient to upload only their own medical documents. |
| Preview | Show the original document and extracted data. |
| Consent | Ask for consent before AI-assisted processing. |
| Completion | Confirm when the report joins the smart report view. |
Sources
- ABDM PHR app documentation (DOCX→MD, 2026-08)
