National Health AuthorityNHA Docs

Command Palette

Search for a command to run...

Scan and Share

Share a patient profile from a PHR app to a facility and receive an OPD token.

Scan and Share lets a patient share basic profile data with a facility. The facility uses it for OPD registration, payment, or record share. The PHR app must ask for consent before it shares data.

The QR code contains a URL. The URL includes the HIP ID and a facility-defined context. The context usually identifies a counter.

Verify profile share schema

The source gives API paths and screenshots. The request example below follows the referenced patient share Swagger. Verify the final schema before certification.

OPD token flow

sequenceDiagram
  participant Patient
  participant App as PHR app
  participant CM as HIE-CM
  participant Facility as HIP or HMIS
  Patient->>App: Scan facility QR
  App->>Patient: Show profile data and consent text
  Patient->>App: Give consent
  App->>CM: POST /patient-share/v3/share
  CM->>Facility: POST callback /patient/share
  Facility-->>CM: POST /patient-share/v3/on-share
  CM-->>App: POST callback /patient/on-share
  App->>Patient: Show token number

Scan the facility QR

Read the HIP ID and context from the QR URL. Validate the facility name before you show patient data.

Show all profile fields that the app will share. Use ABDM consent language. Tell the patient the facility can use data for registration and record linking.

Share the profile

Call HIE-CM after the patient gives consent.

Share patient profile
curl -X POST "https://dev.abdm.gov.in/api/hiecm/patient-share/v3/share" \
  -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 '{
    "intent": "PROFILE_SHARE",
    "metaData": {
      "hipId": "HIP_1",
      "context": "OPD1",
      "hprId": "abdulkalam@hpr.abdm",
      "latitude": 20.5937,
      "longitude": 78.9629
    },
    "profile": {
      "patient": {
        "abhaNumber": "91-7507-6821-7770",
        "abhaAddress": "john.doe@sbx",
        "name": "John Doe",
        "gender": "M",
        "dayOfBirth": "14",
        "monthOfBirth": "11",
        "yearOfBirth": "1998",
        "address": {
          "line": "Street number 5",
          "district": "Nashik",
          "state": "Maharashtra",
          "pincode": "422003"
        },
        "phoneNumber": "9876543210"
      }
    }
  }'
Response (202)
{
  "status": "ACCEPTED"
}

Handle the token callback

Receive the facility response through the HIE-CM callback. Show the token number to the patient.

Profile share callback
{
  "acknowledgement": {
    "status": "SUCCESS",
    "abhaAddress": "john.doe@sbx",
    "profile": {
      "context": "OPD1",
      "tokenNumber": "A103",
      "expiry": 1800
    }
  },
  "response": {
    "requestId": "6f0b4665-a915-4c92-aa36-65afb4a2cd71"
  }
}

Prevent duplicate tokens

Do not let the patient generate a second token for the same facility within 60 minutes. Show the previous token if it remains valid.

QR use cases

Use this flow when the patient opens a scanner inside a PHR app.

CheckRequirement
LoginThe patient logs in to the PHR app.
ScanThe patient taps the QR icon and scans the facility QR.
ConsentThe app shows profile details and asks for consent.
ShareThe app shares the profile after consent.
TokenThe app shows a token number and validity.

Counter rules

RuleRequirement
LengthUse up to 20 alphanumeric characters.
ExamplesUse values such as OPD, OPD1, IPD1, Pharmacy, or General OPD.
Do not useDo not use HFR facility ID, HPID, HIP ID, or HIP name.
NamingDo not use a random or meaningless value.

Token history

Use token history to show previous tokens for a patient.

Get token details
curl -X GET "https://dev.abdm.gov.in/api/hiecm/patient-share/v3/profile/getTokenDetails" \
  -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>"
Response
{
  "tokens": [
    {
      "hipId": "HIP_1",
      "context": "OPD1",
      "tokenNumber": "A103",
      "issuedAt": "2026-08-11T08:40:00.000Z",
      "expiresAt": "2026-08-11T09:10:00.000Z"
    }
  ]
}

Facility response time

The source expects the facility to respond within 30 seconds. Show a clear pending state while the app waits.

Sources

  • ABDM PHR app documentation (DOCX→MD, 2026-08)