@Vinay
- Generate session token by submitting a POST request of the following JSON format
{ "clientId" : "XXX", "clientSecret" :"YYY" }
to https://dev.abdm.gov.in/gateway/v0.5/sessions
2. Get public key of ABDM (to be used for encryption) by submitting a get request to https://healthidsbx.abdm.gov.in/api/v1/auth/cert with
`Content-Encoding: application/json
Authorization: Bearer token-received-in-step-1
Accept-Language: en-us`
- Encrypt Aadhaar using public key in RSA/ECB/OAEPWithSHA-1AndMGF1Padding mode.
- Create a JSON packet in following format:
{"txnId":"","scope":["abha-enrol"],"loginHint":"aadhaar","otpSystem":"aadhaar","loginId":"encrypted-aadhaar"}
- Submit the packet to https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/request/otp along with following headers :
Content-Encoding: application/json Authorization: Bearer token-received-in-step-1 Accept-Language: en-us REQUEST-ID: uuidv4 TIMESTAMP: 2023-12-05T17:17:32.246Z Content-Type: application/json
Response will be received in following format:
{ "txnId": "32187f01-075a-40bd-82ac-e1be02c159e4", "message": "OTP sent to Aadhaar registered mobile number ending with ******5156", "statusMessage": "OK" }
- Encrypt the OTP received in step 5 on Mobile using using public key
(received in step 2) in RSA/ECB/OAEPWithSHA-1AndMGF1Padding mode.
- create a JSON packet in following format:
{ "authData": { "authMethods": [ "otp" ], "otp": { "txnId": "txnId-received-in-step-5", "otpValue": "encrypted-otp-in-step-6", "timeStamp": "2023-12-05T18:12:38", "mobile": "mobile-number-of-the-patient" } }, "consent": { "code": "abha-enrollment", "version": "1.4" } }
- Submit the JSON packet created in step 7 to
https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/enrol/byAadhaar with following headers:
Content-Encoding: application/json Authorization: Bearer token-received-in-step-1 Accept-Language: en-us REQUEST-ID: 592031f9-59d8-46e3-9235-a3c818ecb22c TIMESTAMP: 2023-12-05T18:12:45.450Z TRANSACTION_ID: 142bc004-ac47-495f-9877-4e786b438a7d
- The response packet will be in the format below:
{ "message": "new account", "txnId": "142bc004-ac47-495f-9877-4e786b438a7d", "tokens": { "token": "token", "expiresIn": 1800, "refreshToken": "refresh-token", "refreshExpiresIn": 1296000 }, "ABHAProfile": { "firstName": "Satyadeep", "middleName": "", "lastName": "Kumar", "dob": "25-08-1978", "gender": "M", "photo": "image-from-aadhaar-in-base64", "mobile": "9711475156", "email": null, "phrAddress": [ "91661258485043@sbx" ], "address": "K-35/d, Pocket-k, Shekh Sarai-2, Malviya Nagar, South Delhi, Delhi", "districtCode": "83", "stateCode": "7", "pinCode": "110017", "abhaType": "STANDARD", "ABHANumber": "91-6612-5848-5043", "abhaStatus": "ACTIVE" }, "isNew": true }
- Call https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/enrol/suggestion with following headers to get a list of suggested abha addresses:
Content-Encoding: application/json Authorization: Bearer token-received-in-step-1 Accept-Language: en-us REQUEST-ID: 592031f9-59d8-46e3-9235-a3c818ecb22c TIMESTAMP: 2023-12-05T18:12:45.450Z TRANSACTION_ID: txnId-received-in-step-9
- The response will be in this format:
{ "txnId": "142bc004-ac47-495f-9877-4e786b438a7d", "abhaAddressList": [ "satyadeep1978", "satyadeep2581978", "satyadeepkumar.25", "satyadeep.2581978", "kumar.258", "satyadeep258", "satyadeepkumar1978", "satyadeep_kumar", "satyadeep_258", "satyadeep_2581978", "kumar_258", "satyadeep.258", "satyadeepkumar_25", "satyadeepkumar25", "satyadeep.1978", "satyadeepkumar", "satyadeep_1978", "25_satyadeep.kumar" ] }
- Create a JSON packet in the following format:
{ "txnId" : "txnId-received-in-step-11", "abhaAddress" ": "selected-abha-address-from-step-11", "preferred" : 1 }
- Submit the packet to https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/enrol/abha-address with following headers:
Content-Encoding: application/json Authorization: Bearer token-received-in-step-1 Accept-Language: en-us REQUEST-ID: uuidv4 TIMESTAMP: 2023-12-05T17:17:32.246Z Content-Type: application/json
- Response will be in following format:
{ "txnId": "txnId-received-in-step-11", "healthIdNumber": "abha-number", "preferredAbhaAddress": "selected-abha-address-from-step-11" }