LabStack

Pharmacy API

v1.2.0Sign in

Authentication

API key issued by LabStack. Pass this in every request header. Your store can hold two active keys at once, so you can move to a new key before the old one is revoked. A key may have an expiry date; a request made with an expired or revoked key is refused as unauthorized. Header: ls-api-key

API for ordering medicines from your pharmacy network — serviceability, catalogue search and prices, estimates, orders, prescriptions and cancellation. Every call must include a valid ls-api-key header, and every change to an order is sent to your pharmacy webhook.

Catalog

Get alternatives

Other drugs with the same salt composition as drugMasterId - other brands and packs of the same medicine - that your pharmacy network lists, by name, in the same shape as Search Drugs. Send lsPharmacyId to find alternatives one pharmacy stocks, for example to replace a drug Get Estimate reports unavailable there. drug is the drug you asked about, with its own listings. An order is never substituted automatically: only the drugMasterIds you send to Place Order are ordered, so an alternative has to be ordered explicitly. A drug with no salt composition on record has no alternatives. An alternative with notForSale: true - a Schedule X or habit-forming drug - cannot be ordered online either.

Query parameters

drugMasterIdstringRequired

The drug to find alternatives for

lsPharmacyIdintegerOptional

Optional. Only alternatives this network pharmacy lists.

pageintegerOptional

Optional. 1-based. Default 1. A page past totalPages is a 400.

pageSizeintegerOptional

Optional. Default 20, at most 100.

Responses

200

The drug and a page of its alternatives

{
statusstring
Enum:success
drugobject

The drug asked about, in the Search Drugs shape

countinteger

Alternatives across all pages

pageinteger
pageSizeinteger
totalPagesinteger
alternativesarray<object>

Drugs in the Search Drugs shape

}
400

Bad request — missing or invalid parameters

{
statusstring
Enum:failure
errorstring
}
401

Unauthorized — API key missing, invalid, expired or revoked

{
statusstring
Enum:failure
errorstring
}
404

No such drug in the catalogue

{
statusstring
Enum:failure
errorstring
}
429

Too many failed authentication attempts from your address. Every request from that address is refused, whatever key it carries, until the number of seconds in the Retry-After header has passed.

{
statusstring
Enum:failure
errorstring
}
Sample response
{
  "status": "success",
  "drug": {
    "drugMasterId": "LSD100001",
    "name": "Crocin 500 Tablet",
    "saltCompositionId": "SALT00045",
    "saltCompositionName": "Paracetamol 500mg",
    "prescriptionRequired": false,
    "notForSale": false,
    "packContainer": "strip",
    "packQty": 15,
    "packUnit": null,
    "pharmacies": [
      {
        "lsPharmacyId": 456,
        "pharmacyName": "City Health Pharmacy",
        "mrp": 32,
        "customerPrice": 28.8,
        "storePrice": 27.2
      }
    ]
  },
  "count": 1,
  "page": 1,
  "pageSize": 20,
  "totalPages": 1,
  "alternatives": [
    {
      "drugMasterId": "LSD100045",
      "name": "Dolo 500 Tablet",
      "saltCompositionId": "SALT00045",
      "saltCompositionName": "Paracetamol 500mg",
      "prescriptionRequired": false,
      "notForSale": false,
      "packContainer": "strip",
      "packQty": 10,
      "packUnit": null,
      "pharmacies": [
        {
          "lsPharmacyId": 456,
          "pharmacyName": "City Health Pharmacy",
          "mrp": 30,
          "customerPrice": 27,
          "storePrice": 25.5
        }
      ]
    }
  ]
}

Request example

Request example (cURL)
curl -X GET 'https://integration.labstack.in/api/pharma/v1.0/catalog/getAlternatives?drugMasterId=LSD100001&lsPharmacyId=456&page=1&pageSize=20' \
  -H 'ls-api-key: <YOUR_API_KEY>'

Get drug details

One drug, in the same shape Search Drugs returns: its salt composition, whether a prescription is required, its pack, and each network pharmacy that lists it with the MRP, customer price and your store's price there, cheapest to the customer first. Send lsPharmacyId for one pharmacy's listing only. A drug your network does not list comes back with an empty pharmacies. Prices are from the catalogue and listing is not live stock; Get Estimate gives the live price and stock for a basket. A drug that cannot be sold online - a Schedule X or habit-forming drug - is returned with notForSale: true and prescriptionRequired: true, so its details can be shown; Get Estimate and Place Order reject a basket that contains it.

Query parameters

drugMasterIdstringRequired

LabStack drug id

lsPharmacyIdintegerOptional

Optional. Only this network pharmacy's listing.

Responses

200

The drug and its listings in your network

{
statusstring
Enum:success
drugobject
{
drugMasterIdstring
namestring
saltCompositionIdstring | null
saltCompositionNamestring | null
prescriptionRequiredboolean

True when a prescription must be sent with the order, or when that is unconfirmed. Always true when notForSale is.

notForSaleboolean

True for a Schedule X or habit-forming drug, which cannot be ordered online. Get Estimate and Place Order reject it.

packContainerstring | null

What the pack is, e.g. strip, bottle, vial. The same at every pharmacy.

packQtynumber | null

How much the pack holds, counted in packUnit - or in units of the dosage form (tablets, capsules) when packUnit is null.

packUnitstring | null

Unit of packQty, e.g. ml, gm. Null when packQty is a count.

pharmaciesarray<object>

Cheapest to the customer first

{
lsPharmacyIdinteger
pharmacyNamestring
mrpnumber | null
customerPricenumber | null

mrp less your store's customer medicine discount

storePricenumber | null

What your store owes LabStack per pack: mrp less your store's own medicine discount

}[]
}
}
400

Bad request — missing or invalid parameters

{
statusstring
Enum:failure
errorstring
}
401

Unauthorized — API key missing, invalid, expired or revoked

{
statusstring
Enum:failure
errorstring
}
404

No such drug in the catalogue

{
statusstring
Enum:failure
errorstring
}
429

Too many failed authentication attempts from your address. Every request from that address is refused, whatever key it carries, until the number of seconds in the Retry-After header has passed.

{
statusstring
Enum:failure
errorstring
}
Sample response
{
  "status": "success",
  "drug": {
    "drugMasterId": "LSD100001",
    "name": "Azithral 500 Tablet",
    "saltCompositionId": "SALT00112",
    "saltCompositionName": "Azithromycin 500mg",
    "prescriptionRequired": true,
    "notForSale": false,
    "packContainer": "strip",
    "packQty": 5,
    "packUnit": null,
    "pharmacies": [
      {
        "lsPharmacyId": 456,
        "pharmacyName": "City Health Pharmacy",
        "mrp": 120,
        "customerPrice": 108,
        "storePrice": 102
      },
      {
        "lsPharmacyId": 457,
        "pharmacyName": "MG Road Chemist",
        "mrp": 125,
        "customerPrice": 112.5,
        "storePrice": 106.25
      }
    ]
  }
}

Request example

Request example (cURL)
curl -X GET 'https://integration.labstack.in/api/pharma/v1.0/catalog/getDrugDetails?drugMasterId=LSD100001&lsPharmacyId=456' \
  -H 'ls-api-key: <YOUR_API_KEY>'

Search drugs

Pages through the drugs your pharmacy network lists, by name. Send query to search by brand or salt name; omit it to page through the whole catalogue. Send lsPharmacyId to list one pharmacy's drugs only. Each drug is one row with its pack - packContainer, packQty and packUnit, which are the drug's own and the same at every pharmacy - and pharmacies: every network pharmacy that lists it, with its MRP there, customerPrice - what the customer pays, the MRP less your store's customer medicine discount - and storePrice - what your store owes LabStack, the MRP less your store's own medicine discount. count and totalPages count drugs, not pharmacy listings. Prices here are from the catalogue; Get Estimate gives the live price and stock for a basket. prescriptionRequired is true when a prescription must be sent with an order containing the drug, and also when that is not confirmed either way - treat true as "collect a prescription". Drugs that cannot be sold online - Schedule X and habit-forming drugs - are listed so their details can be shown, with notForSale: true and prescriptionRequired: true. Get Estimate and Place Order reject a basket that contains one.

Query parameters

querystringOptional

Optional. Brand or salt name to search for. At least 3 characters when sent.

lsPharmacyIdintegerOptional

Optional. Only drugs this network pharmacy lists.

pageintegerOptional

Optional. 1-based. Default 1. A page past totalPages is a 400.

pageSizeintegerOptional

Optional. Drugs per page. Default 20, at most 100.

Responses

200

A page of drugs

{
statusstring
Enum:success
countinteger

Drugs matching, across all pages

pageinteger
pageSizeinteger
totalPagesinteger
drugsarray<object>
{
drugMasterIdstring

LabStack drug id. Identifies a brand and pack, not a salt.

namestring
saltCompositionIdstring | null
saltCompositionNamestring | null
prescriptionRequiredboolean

True when a prescription must be sent with the order, or when that is unconfirmed. Always true when notForSale is.

notForSaleboolean

True for a Schedule X or habit-forming drug, which cannot be ordered online. Get Estimate and Place Order reject it.

packContainerstring | null

What the pack is, e.g. strip, bottle, vial

packQtynumber | null

How much the pack holds, counted in packUnit - or in units of the dosage form (tablets, capsules) when packUnit is null.

packUnitstring | null

Unit of packQty, e.g. ml, gm. Null when packQty is a count.

pharmaciesarray<object>

Network pharmacies listing the drug, cheapest to the customer first

{
lsPharmacyIdinteger
pharmacyNamestring
mrpnumber | null

MRP per pack. Null when none is on record.

customerPricenumber | null

Customer price per pack: mrp less your store's customer medicine discount

storePricenumber | null

Your store's price per pack, what your store owes LabStack: mrp less your store's own medicine discount

}[]
}[]
}
400

Bad request — missing or invalid parameters

{
statusstring
Enum:failure
errorstring
}
401

Unauthorized — API key missing, invalid, expired or revoked

{
statusstring
Enum:failure
errorstring
}
429

Too many failed authentication attempts from your address. Every request from that address is refused, whatever key it carries, until the number of seconds in the Retry-After header has passed.

{
statusstring
Enum:failure
errorstring
}
Sample response
{
  "status": "success",
  "count": 2,
  "page": 1,
  "pageSize": 20,
  "totalPages": 1,
  "drugs": [
    {
      "drugMasterId": "LSD100001",
      "name": "Paracetamol 500mg Tablet",
      "saltCompositionId": "SALT00045",
      "saltCompositionName": "Paracetamol 500mg",
      "prescriptionRequired": false,
      "notForSale": false,
      "packContainer": "strip",
      "packQty": 10,
      "packUnit": null,
      "pharmacies": [
        {
          "lsPharmacyId": 456,
          "pharmacyName": "City Health Pharmacy",
          "mrp": 30,
          "customerPrice": 27,
          "storePrice": 25.5
        },
        {
          "lsPharmacyId": 457,
          "pharmacyName": "MG Road Chemist",
          "mrp": 32,
          "customerPrice": 28.8,
          "storePrice": 27.2
        }
      ]
    },
    {
      "drugMasterId": "LSD100002",
      "name": "Paracetamol 650mg Tablet",
      "saltCompositionId": "SALT00046",
      "saltCompositionName": "Paracetamol 650mg",
      "prescriptionRequired": false,
      "notForSale": false,
      "packContainer": "strip",
      "packQty": 15,
      "packUnit": null,
      "pharmacies": [
        {
          "lsPharmacyId": 456,
          "pharmacyName": "City Health Pharmacy",
          "mrp": 34,
          "customerPrice": 30.6,
          "storePrice": 28.9
        }
      ]
    }
  ]
}

Request example

Request example (cURL)
curl -X GET 'https://integration.labstack.in/api/pharma/v1.0/catalog/searchDrugs?query=paracetamol&lsPharmacyId=456&page=1&pageSize=20' \
  -H 'ls-api-key: <YOUR_API_KEY>'

Serviceability

Check serviceability

Lists the pharmacies in your network that can fulfil an order at a location, with the order types and shipment speeds each offers there. Send pincode, a latitude/longitude pair, or both. The optional address fields refine a pincode into a more precise location and require it. HOME_DELIVERY is offered where the pharmacy delivers to the location. PICKUP is offered when the pharmacy's pickup point is within range km of the location - 10 km unless you send range, at most 100. distance says how far away it is, and pickupLocation where the customer collects the order and when the pharmacy is open. A few pharmacies choose the pickup point nearest the customer only when the order is placed; they are listed for PICKUP with a null distance and pickupLocation, and range does not apply to them. Order: with orderType=PICKUP, the nearest pickup point comes first. Otherwise pharmacies come in your network's order of preference, the nearest first among those you prefer equally. A pharmacy with no distance follows those with one. Use a returned lsPharmacyId with Search Drugs, Get Estimate and Place Order, and send Get Estimate and Place Order the same location and range: they apply the same rules. A shipmentSpeed you send to them must be one of that pharmacy's shipmentSpeeds; an empty list means the pharmacy offers no choice of speed, so omit it.

Query parameters

pincodestringOptional

Required unless latitude and longitude are sent. 6 digits.

latitudenumberOptional

Required unless pincode is sent. -90 to 90. Send with longitude.

longitudenumberOptional

Required unless pincode is sent. -180 to 180. Send with latitude.

orderTypestringOptional
Enum:HOME_DELIVERYPICKUP

Optional. Only pharmacies taking this order type. PICKUP also lists the nearest pickup point first.

rangenumberOptional

Optional. How far, in km, a pickup point may be from the location for PICKUP to be offered. Greater than 0 and at most 100; may be fractional. Default 10.

shipmentSpeedstringOptional
Enum:STANDARDEXPRESSSAME_DAYPAN_INDIA

Optional. Only pharmacies offering this speed at the location.

unitFloorBuildingstringOptional

Optional. Refines the location. Requires pincode.

addressstringOptional

Optional. Refines the location. Requires pincode.

localitystringOptional

Optional. Refines the location. Requires pincode.

citystringOptional

Optional. Refines the location. Requires pincode.

statestringOptional

Optional. Refines the location. Requires pincode.

Responses

200

Pharmacies that can fulfil an order at the location

{
statusstring
Enum:success
pincodestring | null

The pincode the location resolved to. Null only when latitude and longitude alone were sent and your network has no pharmacies.

latitudenumber | null

The point distances are measured from. Null only when a pincode alone was sent and no answer depended on a more precise location; PICKUP is then offered only by pharmacies that choose the pickup point when the order is placed.

longitudenumber | null
pharmaciesarray<object>

In the order described above. Empty when no network pharmacy serves the location.

{
lsPharmacyIdinteger

Pass as lsPharmacyId to Get Estimate and Place Order

pharmacyNamestring
orderTypesarray<string>

The order types this pharmacy takes at the location

shipmentSpeedsarray<string>

Speeds you may request. Empty when the pharmacy offers no choice.

distancenumber | null

Km from the location to the pickup point, to 2 decimal places. Null unless orderTypes includes PICKUP and the pickup point is known.

pickupLocationobject | null

Where the customer collects a PICKUP order. Null exactly when distance is.

{
addressstring | null
localitystring | null
citystring | null
statestring | null
pincodestring | null
latitudenumber
longitudenumber
openingTimestring | null

HH:mm, India time, the same every day. Null together with closingTime when the pharmacy is open 24 hours.

closingTimestring | null

HH:mm, India time.

}
}[]
}
400

Bad request — missing or invalid parameters

{
statusstring
Enum:failure
errorstring
}
401

Unauthorized — API key missing, invalid, expired or revoked

{
statusstring
Enum:failure
errorstring
}
429

Too many failed authentication attempts from your address. Every request from that address is refused, whatever key it carries, until the number of seconds in the Retry-After header has passed.

{
statusstring
Enum:failure
errorstring
}
Sample response
{
  "status": "success",
  "pincode": "560038",
  "latitude": 12.9784,
  "longitude": 77.6408,
  "pharmacies": [
    {
      "lsPharmacyId": 456,
      "pharmacyName": "City Health Pharmacy",
      "orderTypes": [
        "HOME_DELIVERY",
        "PICKUP"
      ],
      "shipmentSpeeds": [],
      "distance": 0.74,
      "pickupLocation": {
        "address": "612, 100 Feet Road, HAL 2nd Stage",
        "locality": "Indiranagar",
        "city": "Bangalore",
        "state": "Karnataka",
        "pincode": "560038",
        "latitude": 12.9719,
        "longitude": 77.6412,
        "openingTime": "08:00",
        "closingTime": "22:00"
      }
    },
    {
      "lsPharmacyId": 458,
      "pharmacyName": "Koramangala Medicals",
      "orderTypes": [
        "PICKUP"
      ],
      "shipmentSpeeds": [],
      "distance": 5.83,
      "pickupLocation": {
        "address": "14, 80 Feet Road, 4th Block",
        "locality": "Koramangala",
        "city": "Bangalore",
        "state": "Karnataka",
        "pincode": "560034",
        "latitude": 12.9279,
        "longitude": 77.6271,
        "openingTime": null,
        "closingTime": null
      }
    },
    {
      "lsPharmacyId": 457,
      "pharmacyName": "MG Road Chemist",
      "orderTypes": [
        "HOME_DELIVERY"
      ],
      "shipmentSpeeds": [
        "STANDARD",
        "EXPRESS"
      ],
      "distance": null,
      "pickupLocation": null
    }
  ]
}

Request example

Request example (cURL)
curl -X GET 'https://integration.labstack.in/api/pharma/v1.0/network/checkServiceability?pincode=560001&latitude=12.9716&longitude=77.5946&orderType=&range=&shipmentSpeed=&unitFloorBuilding=&address=42, MG Road&locality=Indiranagar&city=Bangalore&state=Karnataka' \
  -H 'ls-api-key: <YOUR_API_KEY>'

Orders

Cancel order

Cancels one of your orders, by orderId or referenceId. An order the pharmacy has not received yet - waiting for payment, or not accepted automatically - is cancelled at once. Otherwise the pharmacy is asked, and may refuse once it has started on the order; a refusal is a 409, the order keeps its status, and LabStack follows it up with the pharmacy. Cancelling an order that is already CANCELLED succeeds and changes nothing, so a retry is safe. A FULL_DELIVERED or PARTIAL_DELIVERED order cannot be cancelled (409). For an order the pharmacy split into several fulfilments, cancelling any one cancels the whole order; relatedOrders reports where each of the others ended up, since a fulfilment the pharmacy had already accepted is left with it. A cancelled order's referenceId can be used again with Place Order. Money already paid through the order's payment link is owed back, and LabStack arranges the refund.

Request bodyRequired

{
orderIdintegerOptional

LabStack order id. Send this or referenceId.

referenceIdstringOptional

Your own order id. Send this or orderId.

reasonstringOptional

Optional. Recorded as the cancelReason.

}

Responses

200

The order is cancelled

{
statusstring
Enum:success
orderobject
{
orderIdinteger
referenceIdstring | null
orderStatusstring
cancelReasonstring | null
pharmaSuperOrderIdinteger | null
relatedOrdersarray<object>

The other fulfilments of a split order, with their status after the cancellation. Empty otherwise.

{
orderIdinteger
orderStatusstring
}[]
}
}
400

Bad request — missing or invalid parameters

{
statusstring
Enum:failure
errorstring
}
401

Unauthorized — API key missing, invalid, expired or revoked

{
statusstring
Enum:failure
errorstring
}
404

No such order among yours

{
statusstring
Enum:failure
errorstring
}
409

The order is delivered, is already being cancelled, or the pharmacy refused the cancellation

{
statusstring
Enum:failure
errorstring
}
429

Too many failed authentication attempts from your address. Every request from that address is refused, whatever key it carries, until the number of seconds in the Retry-After header has passed.

{
statusstring
Enum:failure
errorstring
}
Sample response
{
  "status": "success",
  "order": {
    "orderId": 1234,
    "referenceId": "MY-REF-001",
    "orderStatus": "CANCELLED",
    "cancelReason": "Patient no longer needs the medication",
    "pharmaSuperOrderId": null,
    "relatedOrders": []
  }
}

Request example

Request example (cURL)
curl -X POST 'https://integration.labstack.in/api/pharma/v1.0/order/cancelOrder' \
  -H 'ls-api-key: <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "orderId": 1234,
    "reason": "Patient no longer needs the medication"
  }'

Get estimate

Prices a basket at a pharmacy before any order exists, for partners that show a total or collect payment on their own platform. The basket is checked exactly as Place Order checks it - your network, the order type, the drugs the pharmacy lists, drugs that are not for sale, the location and the shipment speed - so a basket accepted here is accepted there unless stock or prices change in between. A basket containing a drug marked notForSale (Schedule X or habit-forming) is rejected with a 400 naming it. unitPrice, subTotal and totalAmount are what the customer pays: each drug's MRP less your store's customer medicine discount, plus additionalCharges - delivery and every other fee - on top. storeUnitPrice, storeSubTotal and storeTotalAmount are what your store owes LabStack: each drug's MRP less your store's own medicine discount, plus the same additionalCharges. Both totals are the figures Place Order fixes for the order if nothing changes; re-read them from Place Order's response. allItemsAvailable is false when the pharmacy cannot supply a drug, or not in the quantity asked; Place Order refuses that basket, and the item's available says which. Unavailable items are priced but left out of subTotal and totalAmount. prescriptionRequired is true when Place Order will need a prescription in documents. canCollectPayment is true when Place Order will accept isPaymentRequired for this basket. isLivePrice is false for a pharmacy that prices from its catalogue, whose stock is confirmed only once it receives the order. Location: send the patient's pincode or a latitude/longitude pair, for either order type. PICKUP is accepted on the rules Check Serviceability applies: the pharmacy's pickup point must be within range km of that location (10 unless sent, at most 100), or the call is a 400 giving the distance. distance and pickupLocation then say how far away the pickup point is and where the customer collects the order; both are null for HOME_DELIVERY, and for a pharmacy that chooses the pickup point when the order is placed. expectedDeliveryBy is when a HOME_DELIVERY order placed now would be expected to reach the patient, at the shipmentSpeed you sent or the pharmacy's default when you sent none. It is the time Place Order gives the order if you place it straight away; placing later moves it. An order placed shortly before the pharmacy closes, or while it is closed, is expected after it next opens. Null for PICKUP.

Request bodyRequired

{
orderTypestringRequired
Enum:HOME_DELIVERYPICKUP
lsPharmacyIdintegerRequired

A pharmacy from Check Serviceability

drugsarray<object>Required

One entry per drug. Repeated drugMasterIds are merged; at most 100 of any one drug.

{
drugMasterIdstringRequired
quantityintegerRequired
}[]
pincodestringOptional

The patient's pincode - the delivery pincode for HOME_DELIVERY. Required unless latitude and longitude are sent.

latitudenumberOptional

Optional. Send with longitude. The patient's location when sent: the delivery point, or where a PICKUP distance is measured from.

longitudenumberOptional
rangenumberOptional

Optional, PICKUP only. How far, in km, the pickup point may be from the patient. Greater than 0 and at most 100. Default 10.

unitFloorBuildingstringOptional

Optional. Refines the location. Requires pincode.

addressstringOptional

Optional. Refines the location. Requires pincode.

localitystringOptional

Optional. Requires pincode.

citystringOptional

Optional. Requires pincode.

statestringOptional

Optional. Requires pincode.

shipmentSpeedstringOptional
Enum:STANDARDEXPRESSSAME_DAYPAN_INDIA

Optional. One of the pharmacy's shipmentSpeeds from Check Serviceability. Omit for its default.

namestringOptional

Optional patient name. Send with mobile; some pharmacies quote more precisely with both.

mobilestringOptional

Optional patient mobile. Send with name.

}

Responses

200

The estimate

{
statusstring
Enum:success
estimateobject
{
lsPharmacyIdinteger
pharmacyNamestring
orderTypestring
Enum:HOME_DELIVERYPICKUP
shipmentSpeedstring | null
Enum:STANDARDEXPRESSSAME_DAYPAN_INDIA

The speed quoted; null for the pharmacy default

shipmentSpeedsarray<string>

Speeds the pharmacy offers at this location. Empty when it offers no choice.

expectedDeliveryBystring · date-time | null

HOME_DELIVERY only: when an order placed now would be expected to be delivered. Null for PICKUP.

distancenumber | null

PICKUP only: km from the patient to the pickup point, to 2 decimal places. Null otherwise.

pickupLocationobject | null

PICKUP only: where the customer collects the order. Null exactly when distance is.

{
addressstring | null
localitystring | null
citystring | null
statestring | null
pincodestring | null
latitudenumber
longitudenumber
openingTimestring | null

HH:mm, India time, the same every day. Null together with closingTime when the pharmacy is open 24 hours.

closingTimestring | null

HH:mm, India time.

}
isLivePriceboolean

True when the pharmacy priced the basket and confirmed its stock just now

allItemsAvailableboolean

False when Place Order would refuse the basket for stock

prescriptionRequiredboolean

True when Place Order needs a prescription in documents

canCollectPaymentboolean

True when Place Order accepts isPaymentRequired for this basket

priceobject
{
currencystring
mrpTotalnumber | null

MRP x quantity over the available items. Null when any of them has no MRP on record.

subTotalnumber

The available items at the customer price

additionalChargesnumber

Delivery and every other fee on top of the medicines

totalAmountnumber

subTotal + additionalCharges

storeSubTotalnumber | null

The medicines at your store's price

storeTotalAmountnumber | null

What your store owes LabStack: storeSubTotal + additionalCharges

itemsarray<object>
{
drugMasterIdstring
namestring
packContainerstring | null

What the pack is, e.g. strip, bottle, vial

packQtynumber | null

How much the pack holds, counted in packUnit - or in units of the dosage form (tablets, capsules) when packUnit is null.

packUnitstring | null

Unit of packQty, e.g. ml, gm. Null when packQty is a count.

quantityinteger
mrpnumber | null

MRP per pack

unitPricenumber | null

Customer price per pack

linePricenumber | null

unitPrice x quantity

storeUnitPricenumber | null

Your store's price per pack, what your store owes LabStack: mrp less your store's own medicine discount

storeLinePricenumber | null

storeUnitPrice x quantity

availableboolean
prescriptionRequiredboolean
}[]
}
}
}
400

Bad request — missing or invalid parameters

{
statusstring
Enum:failure
errorstring
}
401

Unauthorized — API key missing, invalid, expired or revoked

{
statusstring
Enum:failure
errorstring
}
429

Too many failed authentication attempts from your address. Every request from that address is refused, whatever key it carries, until the number of seconds in the Retry-After header has passed.

{
statusstring
Enum:failure
errorstring
}
503

The pharmacy could not be reached or could not price the basket. Safe to retry.

{
statusstring
Enum:failure
errorstring
}
Sample response
{
  "status": "success",
  "estimate": {
    "lsPharmacyId": 456,
    "pharmacyName": "City Health Pharmacy",
    "orderType": "HOME_DELIVERY",
    "shipmentSpeed": "STANDARD",
    "shipmentSpeeds": [
      "STANDARD",
      "EXPRESS"
    ],
    "expectedDeliveryBy": "2026-09-29T17:00:00.000Z",
    "distance": null,
    "pickupLocation": null,
    "isLivePrice": true,
    "allItemsAvailable": true,
    "prescriptionRequired": true,
    "canCollectPayment": true,
    "price": {
      "currency": "INR",
      "mrpTotal": 290,
      "subTotal": 261,
      "additionalCharges": 40,
      "totalAmount": 301,
      "storeSubTotal": 246.5,
      "storeTotalAmount": 286.5,
      "items": [
        {
          "drugMasterId": "LSD100001",
          "name": "Azithral 500 Tablet",
          "packContainer": "strip",
          "packQty": 5,
          "packUnit": null,
          "quantity": 2,
          "mrp": 120,
          "unitPrice": 108,
          "linePrice": 216,
          "storeUnitPrice": 102,
          "storeLinePrice": 204,
          "available": true,
          "prescriptionRequired": true
        },
        {
          "drugMasterId": "LSD100002",
          "name": "Paracetamol 650mg Tablet",
          "packContainer": "strip",
          "packQty": 15,
          "packUnit": null,
          "quantity": 1,
          "mrp": 50,
          "unitPrice": 45,
          "linePrice": 45,
          "storeUnitPrice": 42.5,
          "storeLinePrice": 42.5,
          "available": true,
          "prescriptionRequired": false
        }
      ]
    }
  }
}

Request example

Request example (cURL)
curl -X POST 'https://integration.labstack.in/api/pharma/v1.0/order/getEstimate' \
  -H 'ls-api-key: <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "orderType": "HOME_DELIVERY",
    "lsPharmacyId": 456,
    "drugs": [
      {
        "drugMasterId": "LSD100001",
        "quantity": 2
      },
      {
        "drugMasterId": "LSD100002",
        "quantity": 1
      }
    ],
    "pincode": "560001",
    "address": "42, MG Road",
    "city": "Bangalore",
    "state": "Karnataka",
    "shipmentSpeed": "STANDARD"
  }'

Get order details

The full state of one of your orders, by LabStack orderId or by the referenceId you placed it with - send exactly one. items come back in the shape Place Order accepts - drugMasterId and quantity - with the customer price each was placed at, and the store price beside it. unitPrice, subTotal and totalAmount are what the customer pays: MRP less your store's customer medicine discount at the time of placing. storeUnitPrice, storeSubTotal and storeTotalAmount are what your store owes LabStack: MRP less your store's own medicine discount, plus the same additionalCharges. When the order ships, a drug dispatched from a batch printed at a lower MRP is repriced at that MRP with the same discounts, and both sets of totals drop with it; a higher printed MRP never raises a price. An order placed before customer prices were recorded reports the prices it was placed at, with no mrp, null store figures and possibly no additionalCharges. The pharmacy may split an order into several fulfilments, each with its own orderId and status. Such an order carries a pharmaSuperOrderId and lists the other fulfilments in relatedOrders. On a split, totalAmount and storeTotalAmount are for the whole order while price covers this fulfilment only; the delivery charge is made once, so it appears on one fulfilment. A referenceId names the fulfilment Place Order returned. A PICKUP order carries pickupLocation, where the customer collects it - the pharmacy's current address and opening hours. address stays the patient's, as sent to Place Order. expectedDeliveryBy is when a HOME_DELIVERY order is expected to reach the patient: the time Place Order returned, moved only if the order's shipment speed was changed. It stays set once the order is delivered, so you can compare the two. Null for PICKUP, for a CANCELLED order, and while the order waits for payment. On a split order each fulfilment has its own. Every documented field is always present; a value that does not exist is null. Order Status Webhook: every change to an order is POSTed to your store's pharmacy webhook URL, authenticated like your other LabStack webhooks. It carries event (what changed - orderStatus, paymentStatus, shipmentSpeed, pharmacy or drugs), orderId, referenceId, orderStatus, previousStatus, orderType, orderDate, lsPharmacyId, pharmacyName, shipmentSpeed, expectedDeliveryBy, paymentStatus, isPaymentRequired, pharmaSuperOrderId, shipmentTrackingId, totalAmount, cancelReason, uniqueId and userName; call this endpoint for everything else. expectedDeliveryBy there is the value this endpoint returns.

Query parameters

orderIdintegerOptional

LabStack order id. Send this or referenceId.

referenceIdstringOptional

Your own order id, e.g. MY-REF-001. Send this or orderId.

Responses

200

The order

{
statusstring
Enum:success
orderobject
{
orderIdinteger
referenceIdstring | null
orderStatusstring
Enum:PENDINGCREATEDPLACEDCONFIRMEDSHIPPEDPARTIAL_DELIVEREDFULL_DELIVEREDCANCELLED
orderTypestring
Enum:HOME_DELIVERYPICKUP
orderDatestring · date-time
lsPharmacyIdinteger
pharmacyNamestring | null
pickupLocationobject | null

PICKUP only: where the customer collects the order. Null for HOME_DELIVERY, and for a pharmacy that chooses the pickup point when the order is placed.

{
addressstring | null
localitystring | null
citystring | null
statestring | null
pincodestring | null
latitudenumber
longitudenumber
openingTimestring | null

HH:mm, India time, the same every day. Null together with closingTime when the pharmacy is open 24 hours.

closingTimestring | null

HH:mm, India time.

}
shipmentSpeedstring | null
Enum:STANDARDEXPRESSSAME_DAYPAN_INDIA
expectedDeliveryBystring · date-time | null

HOME_DELIVERY only: when the order is expected to be delivered. Null for PICKUP, for a CANCELLED order and while the order waits for payment.

shipmentTrackingIdstring | null
invoiceUrlstring | null

The pharmacy's GST invoice, once issued

notesstring | null
cancelReasonstring | null

Set only on a CANCELLED order

pharmaSuperOrderIdinteger | null

Set when the order was split into several fulfilments

relatedOrdersarray<object>

The other fulfilments of a split order. Empty otherwise.

{
orderIdinteger
orderStatusstring
}[]
isPaymentRequiredboolean

True while the order waits for payment and has not been sent to the pharmacy

paymentStatusstring
Enum:IDLEPENDINGCOMPLETEDCANCELLED
totalAmountnumber | null

What the customer pays for the whole order

storeTotalAmountnumber | null

What your store owes LabStack for the whole order. Null on an order placed before store prices were recorded.

priceobject

This fulfilment: its items and the charges it carries

{
currencystring
mrpTotalnumber | null
subTotalnumber
additionalChargesnumber | null

Null only on an order placed before customer prices were recorded, when unknown

totalAmountnumber
storeSubTotalnumber | null

The medicines at your store's price

storeTotalAmountnumber | null

What your store owes LabStack: storeSubTotal + additionalCharges

itemsarray<object>
{
drugMasterIdstring | null
namestring | null
packContainerstring | null

What the pack is, e.g. strip, bottle, vial

packQtynumber | null

How much the pack holds, counted in packUnit - or in units of the dosage form (tablets, capsules) when packUnit is null.

packUnitstring | null

Unit of packQty, e.g. ml, gm. Null when packQty is a count.

quantityinteger
mrpnumber | null
unitPricenumber | null

Customer price per pack

linePricenumber | null
storeUnitPricenumber | null

Your store's price per pack, what your store owes LabStack: mrp less your store's own medicine discount

storeLinePricenumber | null

storeUnitPrice x quantity

}[]
}
documentsarray<object>
{
documentIdinteger
typestring
Enum:PRESCRIPTIONPRIOR_PRESCRIPTIONREFERRALOTHER
urlstring
}[]
patientobject
{
uniqueIdstring
namestring
dateOfBirthstring | null

YYYY-MM-DD

ageinteger | null
genderstring | null
Enum:MALEFEMALEOTHERS
mobilestring | null
altNumberstring | null
emailstring | null
mainUserUniqueIdstring | null
relationshipstring | null
}
addressobject

The patient's address as sent to Place Order. For PICKUP, see pickupLocation.

{
unitFloorBuildingstring | null
addressstring | null
localitystring | null
citystring | null
statestring | null
pincodestring | null
latitudenumber | null
longitudenumber | null
}
}
}
400

Bad request — missing or invalid parameters

{
statusstring
Enum:failure
errorstring
}
401

Unauthorized — API key missing, invalid, expired or revoked

{
statusstring
Enum:failure
errorstring
}
404

No such order among yours

{
statusstring
Enum:failure
errorstring
}
429

Too many failed authentication attempts from your address. Every request from that address is refused, whatever key it carries, until the number of seconds in the Retry-After header has passed.

{
statusstring
Enum:failure
errorstring
}
Sample response
{
  "status": "success",
  "order": {
    "orderId": 1234,
    "referenceId": "MY-REF-001",
    "orderStatus": "CONFIRMED",
    "orderType": "HOME_DELIVERY",
    "orderDate": "2026-09-29T09:00:00.000Z",
    "lsPharmacyId": 456,
    "pharmacyName": "City Health Pharmacy",
    "pickupLocation": null,
    "shipmentSpeed": "STANDARD",
    "expectedDeliveryBy": "2026-09-29T17:00:00.000Z",
    "shipmentTrackingId": null,
    "invoiceUrl": null,
    "notes": "Leave at reception",
    "cancelReason": null,
    "pharmaSuperOrderId": null,
    "relatedOrders": [],
    "isPaymentRequired": false,
    "paymentStatus": "PENDING",
    "totalAmount": 301,
    "storeTotalAmount": 286.5,
    "price": {
      "currency": "INR",
      "mrpTotal": 290,
      "subTotal": 261,
      "additionalCharges": 40,
      "totalAmount": 301,
      "storeSubTotal": 246.5,
      "storeTotalAmount": 286.5,
      "items": [
        {
          "drugMasterId": "LSD100001",
          "name": "Azithral 500 Tablet",
          "packContainer": "strip",
          "packQty": 5,
          "packUnit": null,
          "quantity": 2,
          "mrp": 120,
          "unitPrice": 108,
          "linePrice": 216,
          "storeUnitPrice": 102,
          "storeLinePrice": 204
        },
        {
          "drugMasterId": "LSD100002",
          "name": "Paracetamol 650mg Tablet",
          "packContainer": "strip",
          "packQty": 15,
          "packUnit": null,
          "quantity": 1,
          "mrp": 50,
          "unitPrice": 45,
          "linePrice": 45,
          "storeUnitPrice": 42.5,
          "storeLinePrice": 42.5
        }
      ]
    },
    "documents": [
      {
        "documentId": 88,
        "type": "PRESCRIPTION",
        "url": "https://files.example.com/prescription.pdf"
      }
    ],
    "patient": {
      "uniqueId": "USR-001",
      "name": "Jane Doe",
      "dateOfBirth": "1990-04-12",
      "age": 36,
      "gender": "FEMALE",
      "mobile": "9876543210",
      "altNumber": null,
      "email": "jane@example.com",
      "mainUserUniqueId": null,
      "relationship": null
    },
    "address": {
      "unitFloorBuilding": null,
      "address": "42, MG Road",
      "locality": null,
      "city": "Bangalore",
      "state": "Karnataka",
      "pincode": "560001",
      "latitude": 12.9716,
      "longitude": 77.5946
    }
  }
}

Request example

Request example (cURL)
curl -X GET 'https://integration.labstack.in/api/pharma/v1.0/order/getOrderDetails?orderId=1234&referenceId=' \
  -H 'ls-api-key: <YOUR_API_KEY>'

Place order

Creates a pharmacy order for a patient and sends it to the pharmacy. The basket is checked exactly as Get Estimate checks it, and the order is created only when the pharmacy can supply every drug in the quantity asked; otherwise the call is a 400 naming the drugMasterIds, and nothing is created. Only the drugMasterIds you send are ordered - nothing is substituted. A drug marked notForSale in the catalogue (Schedule X or habit-forming) cannot be ordered online: a basket containing one is a 400 naming it, whatever prescriptions are sent. Prescriptions go in documents. They are required when any drug needs one (Get Estimate's prescriptionRequired), and they reach the pharmacy with the order. A document added later with Upload Prescription is forwarded by LabStack instead. If the documents cannot be stored the call is a 503, no order is left behind, and it is safe to retry. Send a referenceId - your own order id - to make retries safe: while an order with that referenceId exists and is not cancelled, a second Place Order with it is a 409 that returns the existing orderId. A request identical to one still in progress is also a 409. order.price.totalAmount is what the customer pays: each drug's MRP less your store's customer medicine discount, which is also what the pharmacy invoices the customer, plus additionalCharges. order.price.storeTotalAmount is what your store owes LabStack: each drug's MRP less your store's own medicine discount, plus the same additionalCharges. Both are fixed when the order is placed and never rise afterwards; they drop only if a drug is dispatched from a batch printed at a lower MRP, which Get Order Details then reports. A 200 means LabStack has the order; orderStatus says where it is. PLACED - the pharmacy has it. CREATED - taken by LabStack for a pharmacy it places orders with directly. PENDING - waiting for payment (isPaymentRequired is true), or the pharmacy did not accept it automatically, in which case placementError says so and LabStack follows it up. Every later change arrives on the Order Status Webhook. Set isPaymentRequired to collect payment before the order is sent. The response then carries a paymentLink, valid until paymentLinkExpiresAt (16 minutes). The order stays PENDING and the pharmacy does not see it until it is paid. Once paid it is sent and moves to PLACED - or CREATED for a pharmacy LabStack places orders with directly, or stays PENDING if the pharmacy does not accept it - and the webhook reports it. If the link lapses unpaid the order is cancelled. Payment needs a live price (Get Estimate's canCollectPayment), and when payment cannot be set up the call is a 503 with no order left behind. HOME_DELIVERY needs address, city, state and pincode. PICKUP needs the patient's pincode or a latitude/longitude pair, and is accepted only when the pharmacy's pickup point is within range km of it (10 unless sent, at most 100) - the rule Check Serviceability and Get Estimate apply. pickupLocation in the response is where the customer collects the order. One of dateOfBirth or age is required. expectedDeliveryBy is when a HOME_DELIVERY order is expected to reach the patient, at its shipmentSpeed or the pharmacy's default when none was sent. It is set when the order is placed and moves only if the order's shipment speed is changed; Get Order Details and the Order Status Webhook report it. An order placed shortly before the pharmacy closes, or while it is closed, is expected after it next opens. Null for PICKUP, and while the order waits for payment: the webhook that reports the payment carries it, and it counts from when the order was placed, not from the payment.

Request bodyRequired

{
orderTypestringRequired
Enum:HOME_DELIVERYPICKUP
lsPharmacyIdintegerRequired

A pharmacy from Check Serviceability

drugsarray<object>Required

One entry per drug. Repeated drugMasterIds are merged; at most 100 of any one drug.

{
drugMasterIdstringRequired

Identifies a brand and pack, not a salt

quantityintegerRequired
}[]
referenceIdstringOptional

Optional but recommended. Your own order id. Unique among your orders that are not cancelled; usable with Get Order Details, Cancel Order and Upload Prescription.

namestringRequired

Letters, digits and spaces; other characters are removed.

genderstringRequired
Enum:MALEFEMALEOTHERS
mobilestringRequired

10 digits. A +91 prefix, spaces and dashes are accepted.

dateOfBirthstring · dateOptional

YYYY-MM-DD. Required unless age is sent; used over age when both are.

ageintegerOptional

Whole years. Required unless dateOfBirth is sent.

emailstringOptional

Optional

altNumberstringOptional

Optional alternate contact, 10 digits

uniqueIdstringOptional

Optional. Your id for the patient; the same uniqueId is the same patient on every order. Derived from mobile and name when omitted.

mainUserUniqueIdstringOptional

Optional. uniqueId of an existing patient this one is a dependant of.

relationshipstringOptional

Optional. How the patient relates to mainUserUniqueId, which it requires. Defaults to OTHER.

unitFloorBuildingstringOptional
addressstringOptional

Required for HOME_DELIVERY

localitystringOptional
citystringOptional

Required for HOME_DELIVERY

statestringOptional

Required for HOME_DELIVERY

pincodestringOptional

Required for HOME_DELIVERY. For PICKUP, required unless latitude and longitude are sent. 6 digits.

latitudenumberOptional

Optional. The patient's location, when you have it: the delivery point, or where a PICKUP distance is measured from. Send with longitude.

longitudenumberOptional
rangenumberOptional

Optional, PICKUP only. How far, in km, the pickup point may be from the patient. Greater than 0 and at most 100. Default 10.

shipmentSpeedstringOptional
Enum:STANDARDEXPRESSSAME_DAYPAN_INDIA

Optional. One of the pharmacy's shipmentSpeeds from Check Serviceability. Omit for its default.

notesstringOptional

Optional note for the pharmacy

isPaymentRequiredbooleanOptional

Optional, default false. Hold the order until the returned paymentLink is paid.

documentsarray<object>Optional

Prescriptions. Required when any drug needs one.

{
contentstringRequired

Base64 file content, at most 10 MB. A data-URI prefix is accepted.

fileNamestringRequired

With extension: pdf, jpg, jpeg or png

}[]
}

Responses

200

LabStack has the order. Check orderStatus for where it is.

{
statusstring
Enum:success
orderobject
{
orderIdinteger

LabStack order id

referenceIdstring | null
orderStatusstring
Enum:PLACEDCREATEDPENDING
orderTypestring
Enum:HOME_DELIVERYPICKUP
lsPharmacyIdinteger
pharmacyNamestring
pickupLocationobject | null

PICKUP only: where the customer collects the order. Null for HOME_DELIVERY, and for a pharmacy that chooses the pickup point when the order is placed.

{
addressstring | null
localitystring | null
citystring | null
statestring | null
pincodestring | null
latitudenumber
longitudenumber
openingTimestring | null

HH:mm, India time, the same every day. Null together with closingTime when the pharmacy is open 24 hours.

closingTimestring | null

HH:mm, India time.

}
shipmentSpeedstring | null
expectedDeliveryBystring · date-time | null

HOME_DELIVERY only: when the order is expected to be delivered. Null for PICKUP and while the order waits for payment.

pharmaSuperOrderIdinteger | null

Set when the pharmacy split the order into several fulfilments; Get Order Details lists them. Null otherwise.

isPaymentRequiredboolean

True while the order waits for payment

paymentLinkstring | null

Only when isPaymentRequired was sent true

paymentLinkExpiresAtstring · date-time | null

When an unpaid order is cancelled

placementErrorstring | null

Set when the pharmacy did not accept the order (orderStatus PENDING, isPaymentRequired false). Null otherwise, including for an order waiting for payment.

documentsarray<object>
{
documentIdinteger
}[]
priceobject
{
currencystring
mrpTotalnumber | null

Null when any drug has no MRP on record

subTotalnumber

The medicines at the customer price

additionalChargesnumber

Delivery and every other fee on top of the medicines

totalAmountnumber

What the customer pays: subTotal + additionalCharges

storeSubTotalnumber | null

The medicines at your store's price

storeTotalAmountnumber | null

What your store owes LabStack: storeSubTotal + additionalCharges

itemsarray<object>
{
drugMasterIdstring
namestring
packContainerstring | null

What the pack is, e.g. strip, bottle, vial

packQtynumber | null

How much the pack holds, counted in packUnit - or in units of the dosage form (tablets, capsules) when packUnit is null.

packUnitstring | null

Unit of packQty, e.g. ml, gm. Null when packQty is a count.

quantityinteger
mrpnumber | null
unitPricenumber | null

Customer price per pack

linePricenumber | null
storeUnitPricenumber | null

Your store's price per pack, what your store owes LabStack: mrp less your store's own medicine discount

storeLinePricenumber | null

storeUnitPrice x quantity

}[]
}
}
}
400

Bad request — missing or invalid parameters

{
statusstring
Enum:failure
errorstring
}
401

Unauthorized — API key missing, invalid, expired or revoked

{
statusstring
Enum:failure
errorstring
}
409

An order with this referenceId exists, or an identical request is in progress

{
statusstring
errorstring
orderIdinteger

The existing order, when the referenceId is taken

}
429

Too many failed authentication attempts from your address. Every request from that address is refused, whatever key it carries, until the number of seconds in the Retry-After header has passed.

{
statusstring
Enum:failure
errorstring
}
503

The documents could not be stored or payment could not be set up. No order was left behind; safe to retry.

{
statusstring
Enum:failure
errorstring
}
Sample response
{
  "status": "success",
  "order": {
    "orderId": 1234,
    "referenceId": "MY-REF-001",
    "orderStatus": "PLACED",
    "orderType": "HOME_DELIVERY",
    "lsPharmacyId": 456,
    "pharmacyName": "City Health Pharmacy",
    "pickupLocation": null,
    "shipmentSpeed": "STANDARD",
    "expectedDeliveryBy": "2026-09-29T17:00:00.000Z",
    "pharmaSuperOrderId": null,
    "isPaymentRequired": false,
    "paymentLink": null,
    "paymentLinkExpiresAt": null,
    "placementError": null,
    "documents": [
      {
        "documentId": 88
      }
    ],
    "price": {
      "currency": "INR",
      "mrpTotal": 290,
      "subTotal": 261,
      "additionalCharges": 40,
      "totalAmount": 301,
      "storeSubTotal": 246.5,
      "storeTotalAmount": 286.5,
      "items": [
        {
          "drugMasterId": "LSD100001",
          "name": "Azithral 500 Tablet",
          "packContainer": "strip",
          "packQty": 5,
          "packUnit": null,
          "quantity": 2,
          "mrp": 120,
          "unitPrice": 108,
          "linePrice": 216,
          "storeUnitPrice": 102,
          "storeLinePrice": 204
        },
        {
          "drugMasterId": "LSD100002",
          "name": "Paracetamol 650mg Tablet",
          "packContainer": "strip",
          "packQty": 15,
          "packUnit": null,
          "quantity": 1,
          "mrp": 50,
          "unitPrice": 45,
          "linePrice": 45,
          "storeUnitPrice": 42.5,
          "storeLinePrice": 42.5
        }
      ]
    }
  }
}

Request example

Request example (cURL)
curl -X POST 'https://integration.labstack.in/api/pharma/v1.0/order/placeOrder' \
  -H 'ls-api-key: <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "orderType": "HOME_DELIVERY",
    "lsPharmacyId": 456,
    "referenceId": "MY-REF-001",
    "drugs": [
      {
        "drugMasterId": "LSD100001",
        "quantity": 2
      },
      {
        "drugMasterId": "LSD100002",
        "quantity": 1
      }
    ],
    "name": "Jane Doe",
    "gender": "FEMALE",
    "mobile": "9876543210",
    "dateOfBirth": "1990-04-12",
    "email": "jane@example.com",
    "uniqueId": "USR-001",
    "address": "42, MG Road",
    "city": "Bangalore",
    "state": "Karnataka",
    "pincode": "560001",
    "shipmentSpeed": "STANDARD",
    "documents": [
      {
        "content": "JVBERi0xLjQK...",
        "fileName": "prescription.pdf"
      }
    ]
  }'

Upload prescription

Attaches prescriptions to one of your orders, by orderId or referenceId. Prefer sending them in Place Order's documents, where they reach the pharmacy with the order. forwarding says how these reach the pharmacy. WITH_ORDER - the pharmacy has not received the order yet, and the documents go with it. BY_LABSTACK - the pharmacy already has the order, so LabStack forwards the documents to it; allow time for that before the pharmacy acts on them. A CANCELLED, FULL_DELIVERED or PARTIAL_DELIVERED order takes no documents (409). When some documents are stored and others are not, the call succeeds and errors names the ones that were not; when none are stored it is a 503 and safe to retry.

Request bodyRequired

{
orderIdintegerOptional

LabStack order id. Send this or referenceId.

referenceIdstringOptional

Your own order id. Send this or orderId.

documentsarray<object>Required
{
contentstringRequired

Base64 file content, at most 10 MB. A data-URI prefix is accepted.

fileNamestringRequired

With extension: pdf, jpg, jpeg or png

}[]
}

Responses

200

The documents are attached to the order

{
statusstring
Enum:success
orderobject
{
orderIdinteger
referenceIdstring | null
orderStatusstring
documentsarray<object>
{
documentIdinteger
}[]
forwardingstring
Enum:WITH_ORDERBY_LABSTACK
errorsarray<string>

Documents that were not stored. Empty when all were.

}
}
400

Bad request — missing or invalid parameters

{
statusstring
Enum:failure
errorstring
}
401

Unauthorized — API key missing, invalid, expired or revoked

{
statusstring
Enum:failure
errorstring
}
404

No such order among yours

{
statusstring
Enum:failure
errorstring
}
409

The order is closed and takes no more documents

{
statusstring
Enum:failure
errorstring
}
429

Too many failed authentication attempts from your address. Every request from that address is refused, whatever key it carries, until the number of seconds in the Retry-After header has passed.

{
statusstring
Enum:failure
errorstring
}
Sample response
{
  "status": "success",
  "order": {
    "orderId": 1234,
    "referenceId": "MY-REF-001",
    "orderStatus": "CONFIRMED",
    "documents": [
      {
        "documentId": 89
      }
    ],
    "forwarding": "BY_LABSTACK",
    "errors": []
  }
}

Request example

Request example (cURL)
curl -X POST 'https://integration.labstack.in/api/pharma/v1.0/order/uploadPrescription' \
  -H 'ls-api-key: <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "orderId": 1234,
    "documents": [
      {
        "content": "JVBERi0xLjQK...",
        "fileName": "prescription.pdf"
      }
    ]
  }'