Skip to main content
POST
/
abdm
/
v1
/
consents
/
create
cURL
curl --request POST \
  --url https://api.eka.care/abdm/v1/consents/create \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "appointment_id": "<string>",
  "care_contexts": [
    {
      "cc_ref": "<string>",
      "patient_ref": "<string>"
    }
  ],
  "hip_identifier": {
    "id": "<string>",
    "name": "<string>"
  },
  "hiu": {
    "clinic_id": "<string>",
    "d_oid": "<string>",
    "requester": {
      "identifier": {
        "system": "<string>",
        "type": "<string>",
        "value": "<string>"
      },
      "name": "<string>"
    }
  },
  "patient": {
    "health_id": "<string>",
    "oid": "<string>"
  },
  "period": {
    "expiry": "2023-11-07T05:31:56Z",
    "from": "2023-11-07T05:31:56Z",
    "to": "2023-11-07T05:31:56Z"
  }
}
'
import requests

url = "https://api.eka.care/abdm/v1/consents/create"

payload = {
    "appointment_id": "<string>",
    "care_contexts": [
        {
            "cc_ref": "<string>",
            "patient_ref": "<string>"
        }
    ],
    "hip_identifier": {
        "id": "<string>",
        "name": "<string>"
    },
    "hiu": {
        "clinic_id": "<string>",
        "d_oid": "<string>",
        "requester": {
            "identifier": {
                "system": "<string>",
                "type": "<string>",
                "value": "<string>"
            },
            "name": "<string>"
        }
    },
    "patient": {
        "health_id": "<string>",
        "oid": "<string>"
    },
    "period": {
        "expiry": "2023-11-07T05:31:56Z",
        "from": "2023-11-07T05:31:56Z",
        "to": "2023-11-07T05:31:56Z"
    }
}
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({
    appointment_id: '<string>',
    care_contexts: [{cc_ref: '<string>', patient_ref: '<string>'}],
    hip_identifier: {id: '<string>', name: '<string>'},
    hiu: {
      clinic_id: '<string>',
      d_oid: '<string>',
      requester: {
        identifier: {system: '<string>', type: '<string>', value: '<string>'},
        name: '<string>'
      }
    },
    patient: {health_id: '<string>', oid: '<string>'},
    period: {
      expiry: '2023-11-07T05:31:56Z',
      from: '2023-11-07T05:31:56Z',
      to: '2023-11-07T05:31:56Z'
    }
  })
};

fetch('https://api.eka.care/abdm/v1/consents/create', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.eka.care/abdm/v1/consents/create",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'appointment_id' => '<string>',
    'care_contexts' => [
        [
                'cc_ref' => '<string>',
                'patient_ref' => '<string>'
        ]
    ],
    'hip_identifier' => [
        'id' => '<string>',
        'name' => '<string>'
    ],
    'hiu' => [
        'clinic_id' => '<string>',
        'd_oid' => '<string>',
        'requester' => [
                'identifier' => [
                                'system' => '<string>',
                                'type' => '<string>',
                                'value' => '<string>'
                ],
                'name' => '<string>'
        ]
    ],
    'patient' => [
        'health_id' => '<string>',
        'oid' => '<string>'
    ],
    'period' => [
        'expiry' => '2023-11-07T05:31:56Z',
        'from' => '2023-11-07T05:31:56Z',
        'to' => '2023-11-07T05:31:56Z'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.eka.care/abdm/v1/consents/create"

	payload := strings.NewReader("{\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\": \"<string>\",\n    \"d_oid\": \"<string>\",\n    \"requester\": {\n      \"identifier\": {\n        \"system\": \"<string>\",\n        \"type\": \"<string>\",\n        \"value\": \"<string>\"\n      },\n      \"name\": \"<string>\"\n    }\n  },\n  \"patient\": {\n    \"health_id\": \"<string>\",\n    \"oid\": \"<string>\"\n  },\n  \"period\": {\n    \"expiry\": \"2023-11-07T05:31:56Z\",\n    \"from\": \"2023-11-07T05:31:56Z\",\n    \"to\": \"2023-11-07T05:31:56Z\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.eka.care/abdm/v1/consents/create")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\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\": \"<string>\",\n    \"d_oid\": \"<string>\",\n    \"requester\": {\n      \"identifier\": {\n        \"system\": \"<string>\",\n        \"type\": \"<string>\",\n        \"value\": \"<string>\"\n      },\n      \"name\": \"<string>\"\n    }\n  },\n  \"patient\": {\n    \"health_id\": \"<string>\",\n    \"oid\": \"<string>\"\n  },\n  \"period\": {\n    \"expiry\": \"2023-11-07T05:31:56Z\",\n    \"from\": \"2023-11-07T05:31:56Z\",\n    \"to\": \"2023-11-07T05:31:56Z\"\n  }\n}")
  .asString();
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  \"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\": \"<string>\",\n    \"d_oid\": \"<string>\",\n    \"requester\": {\n      \"identifier\": {\n        \"system\": \"<string>\",\n        \"type\": \"<string>\",\n        \"value\": \"<string>\"\n      },\n      \"name\": \"<string>\"\n    }\n  },\n  \"patient\": {\n    \"health_id\": \"<string>\",\n    \"oid\": \"<string>\"\n  },\n  \"period\": {\n    \"expiry\": \"2023-11-07T05:31:56Z\",\n    \"from\": \"2023-11-07T05:31:56Z\",\n    \"to\": \"2023-11-07T05:31:56Z\"\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>"
  }
}

Authorizations

Authorization
string
header
required

The API requires a Bearer token (JWT) for authentication.

Headers

X-Pt-Id
string

Eka User ID (OID)

X-Partner-Pt-Id
string

Partner User ID

X-Hip-Id
string

Partner HIP ID

Body

application/json
appointment_id
string
care_contexts
object[]
hip_identifier
object
hiu
object
patient
object
period
object
purpose
enum<string>
Available options:
Self Requested,
Care management,
Public Health,
Disease Specific Health Research
record_types
string[] | null

Available options: OPConsultation, Prescription, DischargeSummary, DiagnosticReport, ImmunizationRecord, HealthDocumentRecord, WellnessRecord Invoice

Response

No Content