curl --request POST \
--url https://api.eka.care/ipd/v1/service/dawakhana/orders/{order_id}/return \
--header 'Content-Type: application/json' \
--header 'auth: <auth>' \
--data '
{
"lines": [
{
"itemId": "66f1cd07e4b0a1b2c3d4ef0b",
"returnQty": 4
}
],
"reason": "Patient discharged early"
}
'import requests
url = "https://api.eka.care/ipd/v1/service/dawakhana/orders/{order_id}/return"
payload = {
"lines": [
{
"itemId": "66f1cd07e4b0a1b2c3d4ef0b",
"returnQty": 4
}
],
"reason": "Patient discharged early"
}
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({
lines: [{itemId: '66f1cd07e4b0a1b2c3d4ef0b', returnQty: 4}],
reason: 'Patient discharged early'
})
};
fetch('https://api.eka.care/ipd/v1/service/dawakhana/orders/{order_id}/return', 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/ipd/v1/service/dawakhana/orders/{order_id}/return",
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([
'lines' => [
[
'itemId' => '66f1cd07e4b0a1b2c3d4ef0b',
'returnQty' => 4
]
],
'reason' => 'Patient discharged early'
]),
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/ipd/v1/service/dawakhana/orders/{order_id}/return"
payload := strings.NewReader("{\n \"lines\": [\n {\n \"itemId\": \"66f1cd07e4b0a1b2c3d4ef0b\",\n \"returnQty\": 4\n }\n ],\n \"reason\": \"Patient discharged early\"\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/ipd/v1/service/dawakhana/orders/{order_id}/return")
.header("auth", "<auth>")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"itemId\": \"66f1cd07e4b0a1b2c3d4ef0b\",\n \"returnQty\": 4\n }\n ],\n \"reason\": \"Patient discharged early\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eka.care/ipd/v1/service/dawakhana/orders/{order_id}/return")
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 \"lines\": [\n {\n \"itemId\": \"66f1cd07e4b0a1b2c3d4ef0b\",\n \"returnQty\": 4\n }\n ],\n \"reason\": \"Patient discharged early\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "66f1cd07e4b0a1b2c3d4ef0a",
"admissionId": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"kind": "order",
"orderNumber": "DW-7Q2K9F3M",
"status": "PARTIALLY_RETURNED",
"createdBy": "161467756044203",
"isCollected": false,
"provider": "dawakhana",
"billedTotal": 45,
"fulfilmentType": "FULL",
"returnedBy": "161467756044204",
"returnedByName": "Meena Iyer",
"returnedAt": "2026-10-07T16:00:00.000Z",
"returnReason": "Patient discharged early",
"returnedTotal": 18,
"createdAt": "2026-10-07T12:10:00.000Z",
"updatedAt": "2026-10-07T16:00:00.000Z",
"lines": [
{
"id": "66f1cd07e4b0a1b2c3d4ef0b",
"name": "Paracetamol 500mg Tablet",
"orderedQty": 10,
"fulfilledQty": 10,
"rate": 4.5,
"amount": 45,
"returnedQty": 4,
"lineStatus": "FULFILLED"
}
]
}
}{
"success": false,
"error": "Only a dispatched order can be returned"
}{
"message": "<string>"
}{
"success": false,
"error": "Order not found"
}Return Dawakhana Order
Overview
This API returns medicines against a dispatched Dawakhana order of your workspace. Only an order in status DISPATCHED or PARTIALLY_RETURNED can be returned, so an order can be returned in several steps.
For each line sent, returnQty is capped at the quantity still outstanding (fulfilled minus already returned); lines with nothing left to return are skipped. A line whose whole fulfilled quantity is back becomes RETURNED. The order moves to RETURNED when every fulfilled line is fully returned, otherwise to PARTIALLY_RETURNED.
The returned amount (returnQty × rate) is deducted from the admission’s bill and added to the order’s returnedTotal. A return order (kind: return, with parentOrderId set to this order) is also created. The response is the original order with its updated lines.
curl --request POST \
--url https://api.eka.care/ipd/v1/service/dawakhana/orders/{order_id}/return \
--header 'Content-Type: application/json' \
--header 'auth: <auth>' \
--data '
{
"lines": [
{
"itemId": "66f1cd07e4b0a1b2c3d4ef0b",
"returnQty": 4
}
],
"reason": "Patient discharged early"
}
'import requests
url = "https://api.eka.care/ipd/v1/service/dawakhana/orders/{order_id}/return"
payload = {
"lines": [
{
"itemId": "66f1cd07e4b0a1b2c3d4ef0b",
"returnQty": 4
}
],
"reason": "Patient discharged early"
}
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({
lines: [{itemId: '66f1cd07e4b0a1b2c3d4ef0b', returnQty: 4}],
reason: 'Patient discharged early'
})
};
fetch('https://api.eka.care/ipd/v1/service/dawakhana/orders/{order_id}/return', 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/ipd/v1/service/dawakhana/orders/{order_id}/return",
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([
'lines' => [
[
'itemId' => '66f1cd07e4b0a1b2c3d4ef0b',
'returnQty' => 4
]
],
'reason' => 'Patient discharged early'
]),
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/ipd/v1/service/dawakhana/orders/{order_id}/return"
payload := strings.NewReader("{\n \"lines\": [\n {\n \"itemId\": \"66f1cd07e4b0a1b2c3d4ef0b\",\n \"returnQty\": 4\n }\n ],\n \"reason\": \"Patient discharged early\"\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/ipd/v1/service/dawakhana/orders/{order_id}/return")
.header("auth", "<auth>")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"itemId\": \"66f1cd07e4b0a1b2c3d4ef0b\",\n \"returnQty\": 4\n }\n ],\n \"reason\": \"Patient discharged early\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eka.care/ipd/v1/service/dawakhana/orders/{order_id}/return")
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 \"lines\": [\n {\n \"itemId\": \"66f1cd07e4b0a1b2c3d4ef0b\",\n \"returnQty\": 4\n }\n ],\n \"reason\": \"Patient discharged early\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "66f1cd07e4b0a1b2c3d4ef0a",
"admissionId": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"kind": "order",
"orderNumber": "DW-7Q2K9F3M",
"status": "PARTIALLY_RETURNED",
"createdBy": "161467756044203",
"isCollected": false,
"provider": "dawakhana",
"billedTotal": 45,
"fulfilmentType": "FULL",
"returnedBy": "161467756044204",
"returnedByName": "Meena Iyer",
"returnedAt": "2026-10-07T16:00:00.000Z",
"returnReason": "Patient discharged early",
"returnedTotal": 18,
"createdAt": "2026-10-07T12:10:00.000Z",
"updatedAt": "2026-10-07T16:00:00.000Z",
"lines": [
{
"id": "66f1cd07e4b0a1b2c3d4ef0b",
"name": "Paracetamol 500mg Tablet",
"orderedQty": 10,
"fulfilledQty": 10,
"rate": 4.5,
"amount": 45,
"returnedQty": 4,
"lineStatus": "FULFILLED"
}
]
}
}{
"success": false,
"error": "Only a dispatched order can be returned"
}{
"message": "<string>"
}{
"success": false,
"error": "Order not found"
}Headers
Path Parameters
Id of the dispatched Dawakhana order.
Body
The quantity being returned per line.
Was this page helpful?

