ABDM M1 - harikrushnav/fhir_document GitHub Wiki
| Applicable To | Private Application | Government Application |
|---|---|---|
| Using Aadhaar OTP | Mandatory | Mandatory |
| Using Aadhaar Biometrics | Optional | Mandatory |
| Using Aadhaar Demographics (Offline) | NA | Mandatory |
| Using Driving License | Optional | Optional |
| Create ABHA Address | Mandatory | Mandatory |
| Download ABHA Card | Mandatory | Mandatory |
| Profile Update | Optional | Optional |
| Applicable To | Private Application | Government Application |
|---|---|---|
| Scan Health Facility QR | Mandatory | Mandatory |
| Scan User ABHA QR | Optional | Optional |
| By OTP | Mandatory | Mandatory |
| New vs Returning Patients | Mandatory | Mandatory |
This guide outlines the step-by-step API calls required to create an ABHA number via Aadhaar OTP authentication.
Endpoint:
POST https://dev.abdm.gov.in/api/hiecm/gateway/v3/sessions
Headers:
-
REQUEST-ID: Unique UUID -
TIMESTAMP: ISO 8601 format -
X-CM-ID:sbxorabdm(based on environment)
Body:
{
"clientId": "{{ClientId}}",
"clientSecret": "{{ClientSecret}}",
"grantType": "client_credentials"
}Response:
Returns accessToken.
Public Key API:
GET https://abhasbx.abdm.gov.in/abha/api/v3/profile/public/certificate
Use the received publicKey and the algorithm RSA/ECB/OAEPWithSHA-1AndMGF1Padding to encrypt the Aadhaar number. You may use an external tool such as [DevGlan RSA Encryptor](https://www.devglan.com/online-tools/rsa-encrypt).
Endpoint:
POST {{base_url}}/v3/enrollment/request/otp
Headers:
-
Authorization: Bearer{{accessToken}} -
REQUEST-ID,TIMESTAMP
Body:
{
"txnId": "",
"scope": ["abha-enrol"],
"loginHint": "aadhaar",
"loginId": "{{Encrypted Aadhaar}}",
"otpSystem": "aadhaar"
}Response:
Returns a txnId.
Endpoint:
POST {{base_url}}/v3/enrollment/request/otp
Use the same payload as the previous step.
Endpoint:
POST {{base_url}}/v3/enrollment/enrol/byAadhar
Headers:
-
Authorization: Bearer{{accessToken}} -
REQUEST-ID,TIMESTAMP
Body:
{
"authData": {
"authMethods": ["otp"],
"otp": {
"txnId": "{{txnId}}",
"otpValue": "{{Encrypted OTP}}",
"mobile": "{{MobileNumber}}"
}
},
"consent": {
"code": "abha-enrollment",
"version": "1.4"
}
}Response:
- ABHA profile details including
ABHANumber,phrAddress, andtokens.
You now have an ABHA number created using Aadhaar OTP.
- Valid ABHA Number
- Mobile number linked with ABHA account
- API authentication credentials
POST https://dev.abdm.gov.in/api/hiecm/gateway/v3/sessions
Headers:
-
REQUEST-ID: Unique UUID -
TIMESTAMP: ISO 8601 format -
X-CM-ID:sbxorabdm(based on environment)
Body:
{
"clientId": "{{ClientId}}",
"clientSecret": "{{ClientSecret}}",
"grantType": "client_credentials"
}Response: Returns accessToken.
GET https://dev.abdm.gov.in/api/v1/phr/search/isExist?phrAddress={{proposed_address}}
Headers:
-
Authorization: Bearer{{accessToken}} -
REQUEST-ID,TIMESTAMP
Response:
{
"status": true/false,
"message": "PHR address is available"
}POST https://dev.abdm.gov.in/api/v1/phr/registration/hid/init
Headers:
-
Authorization: Bearer{{accessToken}} -
REQUEST-ID,TIMESTAMP
Body:
{
"healthId": "{{ABHA_Number}}",
"healthIdNumber": "{{ABHA_Number}}"
}Response:
{
"txnId": "a728f282-c56f-4020-a5db-5d9b2a4c7869",
"status": "SUCCESS"
}POST https://dev.abdm.gov.in/api/v1/phr/registration/hid/confirm/init
Headers:
-
Authorization: Bearer{{accessToken}} -
REQUEST-ID,TIMESTAMP
Body:
{
"txnId": "a728f282-c56f-4020-a5db-5d9b2a4c7869"
}Response:
{
"txnId": "a728f282-c56f-4020-a5db-5d9b2a4c7869",
"mobileLinked": true,
"status": "SUCCESS"
}POST https://dev.abdm.gov.in/api/v1/phr/registration/hid/confirm/credential
Headers:
-
Authorization: Bearer{{accessToken}} -
REQUEST-ID,TIMESTAMP
Body:
{
"txnId": "a728f282-c56f-4020-a5db-5d9b2a4c7869",
"authCode": "{{OTP}}"
}Response:
{
"txnId": "a728f282-c56f-4020-a5db-5d9b2a4c7869",
"status": "SUCCESS"
}POST https://dev.abdm.gov.in/api/v1/phr/registration/hid/confirm/phrAddress
Headers:
-
Authorization: Bearer{{accessToken}} -
REQUEST-ID,TIMESTAMP
Body:
{
"txnId": "a728f282-c56f-4020-a5db-5d9b2a4c7869",
"phrAddress": "{{proposed_address}}@abdm",
"password": "Xxxx@1234",
"scope": ["LINK_PHR_ADDRESS"]
}Response:
{
"phrAddress": "johndoe@abdm",
"status": "ACTIVE",
"token": "eyJhbGciOiJSUzI1NiIsInR5...",
"refreshToken": "eyJhbGciOiJSUzI1NiIsInR5...",
"tokenType": "Bearer",
"expiresIn": 1800,
"status": "SUCCESS"
}POST https://dev.abdm.gov.in/api/v1/phr/link/hid
Headers:
-
Authorization: Bearer{{accessToken}} -
REQUEST-ID,TIMESTAMP
Body:
{
"phrAddress": "johndoe@abdm"
}Response:
{
"healthId": "14-XXXX-XXXX-XXXX",
"phrAddress": "johndoe@abdm",
"status": "SUCCESS"
}All APIs return appropriate HTTP status codes:
- 200: Success
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 500: Internal Server Error
Standard error response format:
{
"error": {
"code": "ERROR_CODE",
"message": "Detailed error message"
},
"status": "ERROR"
}- All API calls must include authentication headers
- ABHA Address format follows the pattern
username@abdm - Password must meet the security policy requirements
- OTP validity is typically 10 minutes
- The ABHA Address must be unique in the system