I am trying this to approve a consent request from postman.
-
Fetch care contexts using the following request:-
curl --location ‘https://dev.abdm.gov.in/cm/v1/care-contexts/discover’
–header ‘Content-Type: application/json’
–header ‘X-Auth-Token: {{X-Token}}’
–header ‘Authorization: {{token}}’
–data ‘{
“requestId”: “1d0bcf39-5deb-4ca5-9077-6c8aad49bad1”,
“hip”: {
“id”: “Bahmni”,
“name”: “Bahmni”
},
“unverifiedIdentifiers”: []
}’{{X-Token}} and {{token}} are the ones given in the new postman collection.
Notice: This API seems to be synchronous as I don’t get any on-discover callback for this. Rather the careContexts are present in the response itself. Please correct me here if I am wrong. -
Then I get {{temporaryToken}} using this API: https://dev.abdm.gov.in/cm/patients/verify-pin
-
Then I create consent request using this API: https://dev.abdm.gov.in/gateway/v0.5/consent-requests/init. I receive consent-requests/on-init callback in webhook correctly. The consent request id = e5f103fb-4d5b-4762-b620-414a25482038
-
Then I try to approve consent request using the following API request:-
Where I put in the careContextReference and patientReference from before.curl --location ‘https://dev.abdm.gov.in/cm/consent-requests/e5f103fb-4d5b-4762-b620-414a25482038/approve’
–header ‘X-Auth-Token: {{temporaryToken}}’
–header ‘Content-Type: application/json’
–data ‘{
“consents”: [
{
“careContexts”: [
{
“careContextReference”: “VISIT:aeb6080f-2974-4665-b96e-4efa16636322”,
“patientReference”: “ABC200891”
}
],
“hiTypes”: [
“DiagnosticReport”,
“Prescription”,
“DischargeSummary”,
“OPConsultation”,
“ImmunizationRecord”,
“WellnessRecord”,
“HealthDocumentRecord”
],
“hip”: {
“id”: “Bahmni”,
“name”: “Bahmni”,
“type”: “HIP”
},
“permission”: {
“accessMode”: “VIEW”,
“dataEraseAt”: “2026-07-16T06:00:24.103”,
“dateRange”: {
“from”: “2020-07-15T06:00:24.103”,
“to”: “2022-07-15T06:00:24.103”
},
“frequency”: {
“value”: 1,
“unit”: “HOUR”,
“repeats”: 0
}
}
}
]
}’This is giving me error response saying :-
{
“error”: {
“code”: 1421,
“message”: “Invalid Provider or Care Context.”
}
}
Please help.