Link/Unlink ABHA No to ABHA Address

How to know if the ABHA No linked to the ABHA address as even after unlinking ABHA no using following APIs
Unlink ABHA No API - “v2/account/phr-delinked”
Link ABHA No API - “v2/account/phr-linked”
in PHR profile details API “/v1/apps/profile/me” response ABHA no is still there

hi @shubham_1745

please used phr-portal for Unlink ABHA or Link ABHA Number

from
Areeb

@Areeb Can you share the swagger link or ref document?

I don’t see any API available in swagger below.

https://sandbox.abdm.gov.in/swagger/ndhm-phr-app2.yaml
https://sandbox.abdm.gov.in/swagger/ndhm-phr-app.yaml

ABHA Service Swagger - https://app.swaggerhub.com/apis-docs/abdm.abha/abha-service/1.0/

we are using ABHA service APIs mentioned in the issue description as per the clarification given on mail from ABDM’s team.

Hi @shubham_1745,

LINK API-
POST https://dev.ndhm.gov.in/cm/v1/apps/profile/link/hid

EXAMPLE PAYLOAD-
{“action”:“LINK”,“transactionId”:“9e2d2c49-bf05-47b7-8b31-873848de7988”}


DELINK API-
POST https://dev.ndhm.gov.in/cm/v1/apps/profile/link/hid

EXAMPLE PAYLOAD-
{“action”:“DELINK”,“transactionId”:“9e2d2c49-bf05-47b7-8b31-873848de7988”}

NOTE- Same API is being used for LINK and DELINK.
Only difference is that ‘DELINK’ string is required to send as payload to DELINK.

@atulsharma Can you share the documentation for mentioned API. Currently we are not able to find the API in swaggers we are using for integration.

Swaggers we are referring:
https://app.swaggerhub.com/apis-docs/abdm.abha/abha-service/1.0#/
https://sandbox.abdm.gov.in/swagger/ndhm-phr-app.yaml
https://sandbox.abdm.gov.in/swagger/ndhm-phr-app2.yaml

If not can you mention the whole workflow for API.
e.g. How to get transactionId to Link/Delink the ABHA number

Hi, @shubham_1745

Following is the complete API-Flow. Copy and paste it in notepad and save-as JSON File. Try to import in postman. As attachment facility is not here. I am just pasting it here.

{
“info”: {
“_postman_id”: “e9ade7d5-1dd4-417a-bf16-4d031943c619”,
“name”: “Link_Delink_ABHANumber_ABHAAddress”,
“schema”: “https://schema.getpostman.com/json/collection/v2.1.0/collection.json
},
“item”: [
{
“name”: “1_Session”,
“event”: [
{
“listen”: “test”,
“script”: {
“exec”: [
“var jsonData = pm.response.json(); \r”,
“\r”,
“pm.globals.set(“Auth_Token”, jsonData.accessToken)”
],
“type”: “text/javascript”
}
}
],
“request”: {
“method”: “POST”,
“header”: [],
“body”: {
“mode”: “raw”,
“raw”: “\r\n{\r\n “clientId”: “{{Client_ID}}”,\r\n “clientSecret”: “{{Client_Secret}}”,\r\n “grantType”: “client_credentials”\r\n}”,
“options”: {
“raw”: {
“language”: “json”
}
}
},
“url”: {
“raw”: “{{URL}}/gateway/v0.5/sessions”,
“host”: [
“{{URL}}”
],
“path”: [
“gateway”,
“v0.5”,
“sessions”
]
}
},
“response”: []
},
{
“name”: “2_Auth-Init”,
“event”: [
{
“listen”: “test”,
“script”: {
“exec”: [
“var jsonData = pm.response.json(); \r”,
“\r”,
"pm.globals.set(“TXN_ID”, jsonData.transactionId); "
],
“type”: “text/javascript”
}
}
],
“request”: {
“auth”: {
“type”: “bearer”,
“bearer”: [
{
“key”: “token”,
“value”: “{{Auth_Token}}”,
“type”: “string”
}
]
},
“method”: “POST”,
“header”: [],
“body”: {
“mode”: “raw”,
“raw”: “{\r\n “authMode”: “PASSWORD”,\r\n “patientId”: “{{Patient_ID}}”,\r\n “purpose”: “CM_ACCESS”,\r\n “requester”: {\r\n “id”: “{{PHR_ID}}”,\r\n “type”: “PHR”\r\n }\r\n}”,
“options”: {
“raw”: {
“language”: “json”
}
}
},
“url”: {
“raw”: “{{URL}}/cm/v1/apps/phrAddress/auth-init”,
“host”: [
“{{URL}}”
],
“path”: [
“cm”,
“v1”,
“apps”,
“phrAddress”,
“auth-init”
]
}
},
“response”: []
},
{
“name”: “3_Auth_confirm”,
“event”: [
{
“listen”: “test”,
“script”: {
“exec”: [
“var jsonData = pm.response.json(); \r”,
“\r”,
“pm.globals.set(“x_auth_token”, jsonData.token);”
],
“type”: “text/javascript”
}
}
],
“request”: {
“auth”: {
“type”: “bearer”,
“bearer”: [
{
“key”: “token”,
“value”: “{{Auth_Token}}”,
“type”: “string”
}
]
},
“method”: “POST”,
“header”: [],
“body”: {
“mode”: “raw”,
“raw”: “{\r\n “authCode”: “{{Encrypted_Pwd}}”, // This is the ABHA-App-user(Patient) Encrypted password.\r\n “requesterId”: “phr_001”,\r\n “transactionId”: “{{TXN_ID}}”\r\n}\r\n”,
“options”: {
“raw”: {
“language”: “json”
}
}
},
“url”: {
“raw”: “{{URL}}/cm/v1/apps/phrAddress/auth-confirm”,
“host”: [
“{{URL}}”
],
“path”: [
“cm”,
“v1”,
“apps”,
“phrAddress”,
“auth-confirm”
]
}
},
“response”: []
},
{
“name”: “4_Search-ABHA-Number”,
“request”: {
“auth”: {
“type”: “bearer”,
“bearer”: [
{
“key”: “token”,
“value”: “{{x_auth_token}}”,
“type”: “string”
}
]
},
“method”: “POST”,
“header”: [],
“body”: {
“mode”: “raw”,
“raw”: “{\r\n “healthIdNumber”: “11222233334444”\r\n}”,
“options”: {
“raw”: {
“language”: “json”
}
}
},
“url”: {
“raw”: “{{URL}}/cm/v1/apps/registration/hid/search/auth-mode”,
“host”: [
“{{URL}}”
],
“path”: [
“cm”,
“v1”,
“apps”,
“registration”,
“hid”,
“search”,
“auth-mode”
]
}
},
“response”: []
},
{
“name”: “5_Generate-OTP”,
“event”: [
{
“listen”: “test”,
“script”: {
“exec”: [
“var jsonData = pm.response.json(); \r”,
“\r”,
"pm.globals.set(“transactionId”, jsonData.transactionId); "
],
“type”: “text/javascript”
}
}
],
“request”: {
“auth”: {
“type”: “bearer”,
“bearer”: [
{
“key”: “token”,
“value”: “{{Auth_Token}}”,
“type”: “string”
}
]
},
“method”: “POST”,
“header”: [],
“body”: {
“mode”: “raw”,
“raw”: “{\r\n “authMode”: “MOBILE_OTP”,\r\n “healthIdNumber”: “11-2222-3333-4444”,\r\n “purpose”: “CM_ACCESS”,\r\n “requester”: {\r\n “id”: “phr_001”,\r\n “type”: “PHR”\r\n }\r\n}”,
“options”: {
“raw”: {
“language”: “json”
}
}
},
“url”: {
“raw”: “{{URL}}/cm/v1/apps/login/hid/auth-init”,
“host”: [
“{{URL}}”
],
“path”: [
“cm”,
“v1”,
“apps”,
“login”,
“hid”,
“auth-init”
]
}
},
“response”: []
},
{
“name”: “6_Validate-Mobile-OTP”,
“request”: {
“auth”: {
“type”: “bearer”,
“bearer”: [
{
“key”: “token”,
“value”: “{{Auth_Token}}”,
“type”: “string”
}
]
},
“method”: “POST”,
“header”: [],
“body”: {
“mode”: “raw”,
“raw”: “{\r\n “authCode”: “Sa9xLnlE+u6OwVtlpzYll5RrmGCGzn/+zN6uuE/rWFCOgUzYElKEQD9svzwhJGQjCIY+iFaku/GjXePlRrZT3DUZZr6Nn1tnT/gp+bchpcLtcYyj5ti6fnu/041uehJxxF9HOUDEKutf6v4EPlSClwDp0VUrQJYNM8o4Wh9zAaox+0PKQ2BIuj8+qdxA7V4rZUN59GgLaEkEV6ojg4h+s+Bx1HEzpviebTIVql6F++1I2wfpF2wOknYKWVfoTRBwFjFbEyx6f1055DDpNe0zmI5lKJIJhKhMnCoqEG4kIPceX556pAH6ARop7Xn7t1GonbhbOmFr0dkRa90p2L48LQ==”, // This is the Encrypted-OTP.\r\n “requesterId”: “phr_001”,\r\n “transactionId”: “{{transactionId}}”\r\n}”,
“options”: {
“raw”: {
“language”: “json”
}
}
},
“url”: {
“raw”: “{{URL}}/cm/v1/apps/login/mobileEmail/pre-Verify”,
“host”: [
“{{URL}}”
],
“path”: [
“cm”,
“v1”,
“apps”,
“login”,
“mobileEmail”,
“pre-Verify”
]
}
},
“response”: []
},
{
“name”: “7_Link-Unlink”,
“request”: {
“auth”: {
“type”: “apikey”,
“apikey”: [
{
“key”: “value”,
“value”: “{{x_auth_token}}”,
“type”: “string”
},
{
“key”: “key”,
“value”: “X-AUTH-TOKEN”,
“type”: “string”
}
]
},
“method”: “POST”,
“header”: [],
“body”: {
“mode”: “raw”,
“raw”: “{\r\n “action”: “LINK”, // USE ‘DELINK’ to delink.\r\n “transactionId”: “{{transactionId}}”\r\n}”,
“options”: {
“raw”: {
“language”: “json”
}
}
},
“url”: {
“raw”: “{{URL}}/cm/v1/apps/profile/link/hid”,
“host”: [
“{{URL}}”
],
“path”: [
“cm”,
“v1”,
“apps”,
“profile”,
“link”,
“hid”
]
}
},
“response”: []
}
]
}

Thanks.