Consent Create
curl --request POST \
--url https://api.eka.care/abdm/v1/consents/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"patient": {
"health_id": "bobthebuilder@abdm",
"oid": "162835406498984"
},
"period": {
"expiry": "2009-11-10T23:00:00Z",
"from": "2009-11-10T23:00:00Z",
"to": "2009-11-10T23:00:00Z"
},
"appointment_id": "<string>",
"care_contexts": [
{
"cc_ref": "<string>",
"patient_ref": "<string>"
}
],
"hip_identifier": {
"id": "<string>",
"name": "<string>"
},
"hiu": {
"clinic_id": "afsdfj786fges87f68g8",
"d_oid": "162835406498984",
"requester": {
"identifier": {
"system": "<string>",
"type": "<string>",
"value": "<string>"
},
"name": "<string>"
}
}
}
'import requests
url = "https://api.eka.care/abdm/v1/consents/create"
payload = {
"patient": {
"health_id": "bobthebuilder@abdm",
"oid": "162835406498984"
},
"period": {
"expiry": "2009-11-10T23:00:00Z",
"from": "2009-11-10T23:00:00Z",
"to": "2009-11-10T23:00:00Z"
},
"appointment_id": "<string>",
"care_contexts": [
{
"cc_ref": "<string>",
"patient_ref": "<string>"
}
],
"hip_identifier": {
"id": "<string>",
"name": "<string>"
},
"hiu": {
"clinic_id": "afsdfj786fges87f68g8",
"d_oid": "162835406498984",
"requester": {
"identifier": {
"system": "<string>",
"type": "<string>",
"value": "<string>"
},
"name": "<string>"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
patient: {health_id: 'bobthebuilder@abdm', oid: '162835406498984'},
period: {
expiry: '2009-11-10T23:00:00Z',
from: '2009-11-10T23:00:00Z',
to: '2009-11-10T23:00:00Z'
},
appointment_id: '<string>',
care_contexts: [{cc_ref: '<string>', patient_ref: '<string>'}],
hip_identifier: {id: '<string>', name: '<string>'},
hiu: {
clinic_id: 'afsdfj786fges87f68g8',
d_oid: '162835406498984',
requester: {
identifier: {system: '<string>', type: '<string>', value: '<string>'},
name: '<string>'
}
}
})
};
fetch('https://api.eka.care/abdm/v1/consents/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.eka.care/abdm/v1/consents/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"patient\": {\n \"health_id\": \"bobthebuilder@abdm\",\n \"oid\": \"162835406498984\"\n },\n \"period\": {\n \"expiry\": \"2009-11-10T23:00:00Z\",\n \"from\": \"2009-11-10T23:00:00Z\",\n \"to\": \"2009-11-10T23:00:00Z\"\n },\n \"appointment_id\": \"<string>\",\n \"care_contexts\": [\n {\n \"cc_ref\": \"<string>\",\n \"patient_ref\": \"<string>\"\n }\n ],\n \"hip_identifier\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"hiu\": {\n \"clinic_id\": \"afsdfj786fges87f68g8\",\n \"d_oid\": \"162835406498984\",\n \"requester\": {\n \"identifier\": {\n \"system\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"name\": \"<string>\"\n }\n }\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.eka.care/abdm/v1/consents/create");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"patient\": {\n \"health_id\": \"bobthebuilder@abdm\",\n \"oid\": \"162835406498984\"\n },\n \"period\": {\n \"expiry\": \"2009-11-10T23:00:00Z\",\n \"from\": \"2009-11-10T23:00:00Z\",\n \"to\": \"2009-11-10T23:00:00Z\"\n },\n \"appointment_id\": \"<string>\",\n \"care_contexts\": [\n {\n \"cc_ref\": \"<string>\",\n \"patient_ref\": \"<string>\"\n }\n ],\n \"hip_identifier\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"hiu\": {\n \"clinic_id\": \"afsdfj786fges87f68g8\",\n \"d_oid\": \"162835406498984\",\n \"requester\": {\n \"identifier\": {\n \"system\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"name\": \"<string>\"\n }\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
require 'uri'
require 'net/http'
url = URI("https://api.eka.care/abdm/v1/consents/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"patient\": {\n \"health_id\": \"bobthebuilder@abdm\",\n \"oid\": \"162835406498984\"\n },\n \"period\": {\n \"expiry\": \"2009-11-10T23:00:00Z\",\n \"from\": \"2009-11-10T23:00:00Z\",\n \"to\": \"2009-11-10T23:00:00Z\"\n },\n \"appointment_id\": \"<string>\",\n \"care_contexts\": [\n {\n \"cc_ref\": \"<string>\",\n \"patient_ref\": \"<string>\"\n }\n ],\n \"hip_identifier\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"hiu\": {\n \"clinic_id\": \"afsdfj786fges87f68g8\",\n \"d_oid\": \"162835406498984\",\n \"requester\": {\n \"identifier\": {\n \"system\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"name\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"consent_init_id": "<string>"
}{
"code": 123,
"error": "<string>",
"source_error": {
"code": "<string>",
"message": "<string>"
}
}{
"code": 123,
"error": "<string>",
"source_error": {
"code": "<string>",
"message": "<string>"
}
}Consent and data flow
Consent Create
POST
/
abdm
/
v1
/
consents
/
create
Consent Create
curl --request POST \
--url https://api.eka.care/abdm/v1/consents/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"patient": {
"health_id": "bobthebuilder@abdm",
"oid": "162835406498984"
},
"period": {
"expiry": "2009-11-10T23:00:00Z",
"from": "2009-11-10T23:00:00Z",
"to": "2009-11-10T23:00:00Z"
},
"appointment_id": "<string>",
"care_contexts": [
{
"cc_ref": "<string>",
"patient_ref": "<string>"
}
],
"hip_identifier": {
"id": "<string>",
"name": "<string>"
},
"hiu": {
"clinic_id": "afsdfj786fges87f68g8",
"d_oid": "162835406498984",
"requester": {
"identifier": {
"system": "<string>",
"type": "<string>",
"value": "<string>"
},
"name": "<string>"
}
}
}
'import requests
url = "https://api.eka.care/abdm/v1/consents/create"
payload = {
"patient": {
"health_id": "bobthebuilder@abdm",
"oid": "162835406498984"
},
"period": {
"expiry": "2009-11-10T23:00:00Z",
"from": "2009-11-10T23:00:00Z",
"to": "2009-11-10T23:00:00Z"
},
"appointment_id": "<string>",
"care_contexts": [
{
"cc_ref": "<string>",
"patient_ref": "<string>"
}
],
"hip_identifier": {
"id": "<string>",
"name": "<string>"
},
"hiu": {
"clinic_id": "afsdfj786fges87f68g8",
"d_oid": "162835406498984",
"requester": {
"identifier": {
"system": "<string>",
"type": "<string>",
"value": "<string>"
},
"name": "<string>"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
patient: {health_id: 'bobthebuilder@abdm', oid: '162835406498984'},
period: {
expiry: '2009-11-10T23:00:00Z',
from: '2009-11-10T23:00:00Z',
to: '2009-11-10T23:00:00Z'
},
appointment_id: '<string>',
care_contexts: [{cc_ref: '<string>', patient_ref: '<string>'}],
hip_identifier: {id: '<string>', name: '<string>'},
hiu: {
clinic_id: 'afsdfj786fges87f68g8',
d_oid: '162835406498984',
requester: {
identifier: {system: '<string>', type: '<string>', value: '<string>'},
name: '<string>'
}
}
})
};
fetch('https://api.eka.care/abdm/v1/consents/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.eka.care/abdm/v1/consents/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"patient\": {\n \"health_id\": \"bobthebuilder@abdm\",\n \"oid\": \"162835406498984\"\n },\n \"period\": {\n \"expiry\": \"2009-11-10T23:00:00Z\",\n \"from\": \"2009-11-10T23:00:00Z\",\n \"to\": \"2009-11-10T23:00:00Z\"\n },\n \"appointment_id\": \"<string>\",\n \"care_contexts\": [\n {\n \"cc_ref\": \"<string>\",\n \"patient_ref\": \"<string>\"\n }\n ],\n \"hip_identifier\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"hiu\": {\n \"clinic_id\": \"afsdfj786fges87f68g8\",\n \"d_oid\": \"162835406498984\",\n \"requester\": {\n \"identifier\": {\n \"system\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"name\": \"<string>\"\n }\n }\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.eka.care/abdm/v1/consents/create");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"patient\": {\n \"health_id\": \"bobthebuilder@abdm\",\n \"oid\": \"162835406498984\"\n },\n \"period\": {\n \"expiry\": \"2009-11-10T23:00:00Z\",\n \"from\": \"2009-11-10T23:00:00Z\",\n \"to\": \"2009-11-10T23:00:00Z\"\n },\n \"appointment_id\": \"<string>\",\n \"care_contexts\": [\n {\n \"cc_ref\": \"<string>\",\n \"patient_ref\": \"<string>\"\n }\n ],\n \"hip_identifier\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"hiu\": {\n \"clinic_id\": \"afsdfj786fges87f68g8\",\n \"d_oid\": \"162835406498984\",\n \"requester\": {\n \"identifier\": {\n \"system\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"name\": \"<string>\"\n }\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
require 'uri'
require 'net/http'
url = URI("https://api.eka.care/abdm/v1/consents/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"patient\": {\n \"health_id\": \"bobthebuilder@abdm\",\n \"oid\": \"162835406498984\"\n },\n \"period\": {\n \"expiry\": \"2009-11-10T23:00:00Z\",\n \"from\": \"2009-11-10T23:00:00Z\",\n \"to\": \"2009-11-10T23:00:00Z\"\n },\n \"appointment_id\": \"<string>\",\n \"care_contexts\": [\n {\n \"cc_ref\": \"<string>\",\n \"patient_ref\": \"<string>\"\n }\n ],\n \"hip_identifier\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"hiu\": {\n \"clinic_id\": \"afsdfj786fges87f68g8\",\n \"d_oid\": \"162835406498984\",\n \"requester\": {\n \"identifier\": {\n \"system\": \"<string>\",\n \"type\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"name\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"consent_init_id": "<string>"
}{
"code": 123,
"error": "<string>",
"source_error": {
"code": "<string>",
"message": "<string>"
}
}{
"code": 123,
"error": "<string>",
"source_error": {
"code": "<string>",
"message": "<string>"
}
}Used in
Authorizations
The API requires a Bearer token (JWT) for authentication.
Headers
Eka User ID (OID)
Partner User ID
Partner HIP ID
Body
application/json
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
Self Requested, Care management, Public Health, Disease Specific Health Research Available options: OPConsultation, Prescription, DischargeSummary, DiagnosticReport, ImmunizationRecord, HealthDocumentRecord, WellnessRecord Invoice
This is Optional, mostly used in the context of subscription documents and auto approval
Show child attributes
Show child attributes
This is Optional, mostly used in the context of subscription documents and auto approval
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
No Content
Was this page helpful?

