Skip to main content
POST
/
dr
/
v1
/
patient
Add Patient to Directory
curl --request POST \
  --url https://api.eka.care/dr/v1/patient \
  --header 'Content-Type: application/json' \
  --header 'auth: <auth>' \
  --data '
{
  "dob": "1987-01-06",
  "first_name": "Test",
  "gender": "M",
  "designation": "Mr.",
  "partner_patient_id": "6742984",
  "middle_name": "",
  "last_name": "Patient",
  "mobile": "+919999999999",
  "address": {
    "city": "Bangalore",
    "pincode": 560049
  }
}
'
import requests

url = "https://api.eka.care/dr/v1/patient"

payload = {
    "dob": "1987-01-06",
    "first_name": "Test",
    "gender": "M",
    "designation": "Mr.",
    "partner_patient_id": "6742984",
    "middle_name": "",
    "last_name": "Patient",
    "mobile": "+919999999999",
    "address": {
        "city": "Bangalore",
        "pincode": 560049
    }
}
headers = {
    "auth": "<auth>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {auth: '<auth>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    dob: '1987-01-06',
    first_name: 'Test',
    gender: 'M',
    designation: 'Mr.',
    partner_patient_id: '6742984',
    middle_name: '',
    last_name: 'Patient',
    mobile: '+919999999999',
    address: {city: 'Bangalore', pincode: 560049}
  })
};

fetch('https://api.eka.care/dr/v1/patient', 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/dr/v1/patient",
  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([
    'dob' => '1987-01-06',
    'first_name' => 'Test',
    'gender' => 'M',
    'designation' => 'Mr.',
    'partner_patient_id' => '6742984',
    'middle_name' => '',
    'last_name' => 'Patient',
    'mobile' => '+919999999999',
    'address' => [
        'city' => 'Bangalore',
        'pincode' => 560049
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "auth: <auth>"
  ],
]);

$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/dr/v1/patient"

	payload := strings.NewReader("{\n  \"dob\": \"1987-01-06\",\n  \"first_name\": \"Test\",\n  \"gender\": \"M\",\n  \"designation\": \"Mr.\",\n  \"partner_patient_id\": \"6742984\",\n  \"middle_name\": \"\",\n  \"last_name\": \"Patient\",\n  \"mobile\": \"+919999999999\",\n  \"address\": {\n    \"city\": \"Bangalore\",\n    \"pincode\": 560049\n  }\n}")

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

	req.Header.Add("auth", "<auth>")
	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/dr/v1/patient")
  .header("auth", "<auth>")
  .header("Content-Type", "application/json")
  .body("{\n  \"dob\": \"1987-01-06\",\n  \"first_name\": \"Test\",\n  \"gender\": \"M\",\n  \"designation\": \"Mr.\",\n  \"partner_patient_id\": \"6742984\",\n  \"middle_name\": \"\",\n  \"last_name\": \"Patient\",\n  \"mobile\": \"+919999999999\",\n  \"address\": {\n    \"city\": \"Bangalore\",\n    \"pincode\": 560049\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.eka.care/dr/v1/patient")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["auth"] = '<auth>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"dob\": \"1987-01-06\",\n  \"first_name\": \"Test\",\n  \"gender\": \"M\",\n  \"designation\": \"Mr.\",\n  \"partner_patient_id\": \"6742984\",\n  \"middle_name\": \"\",\n  \"last_name\": \"Patient\",\n  \"mobile\": \"+919999999999\",\n  \"address\": {\n    \"city\": \"Bangalore\",\n    \"pincode\": 560049\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "patient_id": "123456789"
}
{
  "error": {
    "code": "NOT_ALLOWED",
    "message": "You are not allowed to add resource"
  }
}
{
  "error": {
    "code": "PATIENT_ALREADY_EXISTS",
    "message": "Patient already exists with the same partner_patient_id: abc"
  }
}
{
  "error": {
    "code": "INTERNAL_SERVER_ERROR",
    "message": "Internal server error"
  }
}

Headers

auth
string
required

The auth token of business_id. It is used to authenticate the business. The token can be fetched from the auth api.

Body

application/json

Request body for adding a patient to the directory

dob
string<date>
required

Date of birth of the patient (YYYY-MM-DD)

Example:

"1987-01-06"

first_name
string
required

First name of the patient

Example:

"Test"

gender
enum<string>
required

Gender of the patient (e.g., 'M' for male, 'F' for female, 'O' for others)

Available options:
M,
F,
O
Example:

"M"

designation
enum<string>

Title or designation of the patient

Available options:
Mr.,
Ms.,
Mrs.,
Miss.,
Kumar.,
Shri.,
Smt.,
Dr.,
Master.,
Baby.,
Mohd.,
B/O
Example:

"Mr."

partner_patient_id
string

Identifier for the partner’s patient.

Example:

"6742984"

middle_name
string

Middle name of the patient (if any)

Example:

""

last_name
string

Last name of the patient

Example:

"Patient"

mobile
string

Mobile number of the patient, including country code

Example:

"+919999999999"

address
object

Address details of the patient

Response

OK

patient_id
string
Example:

"123456789"