Organization Data API · v1

Push your clinical data
into MEDHAS.

One API key covers every clinic in your organization. Send patient visits, pharmacy stock, diet plans and lab results — they land in the same records MEDHAS clinicians work with, and flow straight into the Organization dashboard, trend charts and AI assistant. No separate reporting path to keep in sync.

Base URLhttps://medhas.co.in/api/external/v1/organizations

Authentication

Every request carries your organization’s API key as a bearer token. There is no separate login step and no token exchange.

Header on every request
Authorization: Bearer <YOUR_API_KEY>
Use your key on this pageFills every code sample below and unlocks the live console.

Kept in this browser tab only (session storage) and sent nowhere except the MEDHAS endpoint you invoke. It is cleared when you close the tab.

Treat the key like a password.

It authorizes writes to every clinic in your organization and is shown only once when generated. Keep it in a server-side secret store, never in client code or version control. If it leaks, ask your MEDHAS contact to revoke it — revocation takes effect immediately.

StatusMeaning
200 AcceptedCheck the per-record status field — a batch can succeed overall and still contain individual record errors.
400 Bad requestMalformed JSON, an empty array, a batch over the 500-record limit, or a single record that was refused.
401 UnauthorizedAuthorization header missing, key unrecognized, or key revoked.
403 ForbiddenThe key lacks the scope this call needs. Nothing was written.
409 ConflictA single Dravya record whose name is already in use (the body gives existingId), or that the clinic archived. Nothing was written.
500 Server errorSomething failed on our side. Safe to retry — idempotency keys prevent duplicates.

Quickstart

The shortest path from a fresh API key to data appearing in MEDHAS.

  1. 1
    Get your API keyMEDHAS provisions one per organization and shares it with you out of band.
  2. 2
    Choose a stable clinic codeYour own identifier per clinic — a branch code works well. That value becomes externalClinicId; the format is entirely yours.
  3. 3
    Send your first visitUse the externalClinicId your MEDHAS administrator mapped to each clinic. A code nobody has mapped is refused with a message saying how to map it.
  4. 4
    Give every record an external idWith externalVisitId set, resending is safe — you get updated back instead of a duplicate.
  5. 5
    Read results per recordBatches return one result per item. Inspect each status rather than assuming the whole batch shared one outcome.
Clinics are mapped first.

Each externalClinicId is mapped to one of your clinics by your MEDHAS administrator. A record for an unmapped code is rejected with a clear message — it never guesses which clinic you meant, and never creates one. Ask your administrator to map a new code before you send records for it.

Severity scale

MEDHAS scores symptom severity on a fixed 0–10 scale internally. Send ratings on whatever scale your system already uses and declare it — the conversion is linear and lossless.

Stored severity7.5/10

normalized = (ratingRaw − 1) ÷ (ratingScale − 1) × 10Your raw value is stored alongside it, so nothing about your original scale is lost.

Visits

Patient encounters — symptoms, diagnosis, medicines, vitals.

POST/api/external/v1/organizations/visits

Create or update a visit

Records one patient encounter — identity, rated symptoms, diagnosis, medicines, vitals and billing in a single call.

idempotent on externalVisitId

Routing

FieldTypeDescription
externalClinicIdrequiredstringYour own clinic code. You choose the format — just keep it stable.
clinicNamestringOptional, for your own reference and for the error message when the code is not mapped. The API never creates a clinic.

Visit

FieldTypeDescription
externalVisitIdstringYour visit id. Re-sending the same id updates that visit instead of duplicating it.
visitDaterequireddateYYYY-MM-DD.
visitTimestringHH:MM, 24-hour. Defaults to 09:00.
nextVisitDatedateYYYY-MM-DD.
treatmentDaysnumberOverall course length.
medicineDaysnumberMedicine course length, if tracked separately.
externalDoctorIdstringYour prescriber id. First sighting creates an attribution record so per-doctor reporting includes your data.
doctorNamestringUsed only when creating that doctor record.
notesstringFree text.

patient

The identity key is externalId — sending it again updates the same patient rather than creating a second one.

FieldTypeDescription
patient.externalIdrequiredstringYour patient id.
patient.namestring—
patient.sexstringM / F / O.
patient.ageYearsnumber—
patient.dobdateYYYY-MM-DD.
patient.mobilestring—
patient.whatsappstring—
patient.emailstring—
patient.addressobjectFree-form; stored as sent.
patient.occupationstring—

symptoms[]

One entry per condition. Rate each symptom on your own scale and declare the scale — MEDHAS normalizes it.

FieldTypeDescription
symptoms[].namerequiredstringCondition name. No fixed vocabulary required.
symptoms[].diseaseIdstringAn NAMC code if you have one — improves catalog matching.
symptoms[].symptoms[].labelrequiredstringSymptom name, free text.
symptoms[].symptoms[].ratingRawrequirednumberSeverity on your scale.
symptoms[].symptoms[].ratingScalenumberTop of your scale, e.g. 5. Defaults to 5.

diseases[]

Diagnosed conditions for this visit, separate from the rated symptom list.

FieldTypeDescription
diseases[].namerequiredstring—
diseases[].diseaseIdstring—
diseases[].statusstringnew / ongoing / resolved. Defaults to ongoing.

medicines[]

Matched by name against the organization product catalog for adoption reporting — consistent naming improves accuracy.

FieldTypeDescription
medicines[].medicineNamerequiredstring—
medicines[].medicineTypestring—
medicines[].doseMorningnumber—
medicines[].doseAfternoonnumber—
medicines[].doseNightnumber—
medicines[].quantitynumber—
medicines[].daysnumberCourse length for this line.
medicines[].instructionstringe.g. "after food".
medicines[].externalInventoryItemIdstringLinks the line to stock you registered via /inventory/batch.

Clinical objects

FieldTypeDescription
diagnosisobject{ ayurved, modern, modernSystem, icdCode } — all optional strings.
doshaBalanceobject{ vata, pitta, kapha } — integers 0–10.
investigationsarray[{ name, result? }] — tests ordered or reviewed at the visit, up to 30.
labResultsarray[{ name, value, unit?, ref?, flag? (low|high) }] — results recorded at the visit, up to 80.
dietAdvicearrayDiet lines for the patient (strings), up to 40.
exercisesarrayYoga / exercise lines (strings), up to 40.
vitalsobject{ bpSystolic, bpDiastolic, temperature, temperatureUnit, height, heightUnit, weight, weightUnit, spo2, pulse }.
billingobject{ consultingFee, medicineFee, paidAmount, paymentMode }.
curl -X POST 'https://medhas.co.in/api/external/v1/organizations/visits' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"externalClinicId":"PUNE-07","clinicName":"Pune Koregaon Park Clinic","externalVisitId":"V-88213","externalDoctorId":"D-42","doctorName":"Dr. Aditi Rao","visitDate":"2026-01-15","patient":{"externalId":"P-10234","name":"Ravi Kumar","sex":"M","ageYears":45},"symptoms":[{"name":"Type 2 Diabetes","symptoms":[{"label":"Frequent urination","ratingRaw":4,"ratingScale":5},{"label":"Excessive thirst","ratingRaw":3,"ratingScale":5}]}],"diseases":[{"name":"Type 2 Diabetes","status":"ongoing"}],"medicines":[{"medicineName":"Nishamalaki Churna","doseMorning":1,"doseNight":1,"quantity":60,"days":30}],"diagnosis":{"ayurved":"Madhumeha","modern":"Type 2 Diabetes Mellitus"},"vitals":{"bpSystolic":130,"bpDiastolic":85,"weight":78,"weightUnit":"kg"},"billing":{"consultingFee":500,"medicineFee":800,"paidAmount":1300,"paymentMode":"cash"}}'
Response · 200
{
  "externalVisitId": "V-88213",
  "status": "created",
  "clinicId": "66f1a2b3c4d5e6f7a8b9c0d1",
  "patientId": "66f1a2b3c4d5e6f7a8b9c0d2"
}
Try itAdd your API key at the top of the page to enable this
/api/external/v1/organizations/visits
POST/api/external/v1/organizations/visits/batch

Send a batch of visits

Up to 500 visits per request. Each record is processed independently — one bad record never fails the rest.

max 500 per requestidempotent on externalVisitId

Body

FieldTypeDescription
visits[]requiredarrayEach element uses exactly the same shape as the single-visit endpoint above.
curl -X POST 'https://medhas.co.in/api/external/v1/organizations/visits/batch' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"visits":[{"externalClinicId":"PUNE-07","externalVisitId":"V-1","visitDate":"2026-01-15","patient":{"externalId":"P-1","name":"Meera Nair"},"medicines":[{"medicineName":"Triphala Churna","quantity":30}]},{"externalClinicId":"PUNE-07","externalVisitId":"V-2","visitDate":"2026-01-15","patient":{"externalId":"P-2","name":"Arjun Shetty"},"diagnosis":{"modern":"Hypertension"}}]}'
Response · 200
{
  "results": [
    {
      "externalVisitId": "V-1",
      "status": "created",
      "clinicId": "…",
      "patientId": "…"
    },
    {
      "externalVisitId": "V-2",
      "status": "error",
      "error": "visitDate is required (YYYY-MM-DD)."
    }
  ],
  "summary": {
    "received": 2,
    "created": 1,
    "error": 1
  }
}
Try itAdd your API key at the top of the page to enable this
/api/external/v1/organizations/visits/batch

Inventory

Pharmacy stock levels, batches and pricing per clinic.

POST/api/external/v1/organizations/inventory/batch

Sync pharmacy stock

Registers or updates stock items for a clinic. Up to 500 items per request.

max 500 per requestidempotent on externalItemId

Routing

FieldTypeDescription
items[].externalClinicIdrequiredstringYour own clinic code. You choose the format — just keep it stable.
items[].clinicNamestringOptional, for your own reference and for the error message when the code is not mapped. The API never creates a clinic.

Item

FieldTypeDescription
items[].externalItemIdstringYour stock id. Re-sending updates the same item.
items[].medicineNamerequiredstringMatched against the organization product catalog.
items[].medicineTypestring—
items[].companystring—
items[].alternateNamestring—
items[].batchNostring—
items[].mfgDatedate—
items[].expDatedate—
items[].packagingSizestring—
items[].packagingTypestring—
items[].stocknumberDefaults to 0 when omitted.
items[].minimumStocknumberDrives low-stock alerts.
items[].ratenumberCost price.
items[].sellRatenumberSelling price.
items[].gstnumber—
items[].hsnstring—
items[].barcodeNostring—
items[].medicineCodestring—
items[].supplierNamestring—
items[].billNostring—
items[].billDatedate—
items[].otcProductboolean—
items[].withBillboolean—
items[].exclusiveGstboolean—
items[].notesstring—
curl -X POST 'https://medhas.co.in/api/external/v1/organizations/inventory/batch' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"items":[{"externalClinicId":"PUNE-07","externalItemId":"SKU-4471","medicineName":"Nishamalaki Churna","stock":120,"minimumStock":15,"sellRate":180,"expDate":"2028-06-30"}]}'
Response · 200
{
  "results": [
    {
      "externalItemId": "SKU-4471",
      "status": "created",
      "id": "66f1a2b3c4d5e6f7a8b9c0d3"
    }
  ],
  "summary": {
    "received": 1,
    "created": 1
  }
}
Try itAdd your API key at the top of the page to enable this
/api/external/v1/organizations/inventory/batch

Diet plans

Custom diet plans built from named food items.

POST/api/external/v1/organizations/diet-plans

Create or update a diet plan

Food items MEDHAS has not seen for this clinic are registered automatically — you never need to match an existing catalog.

idempotent on externalPlanId

Routing

FieldTypeDescription
externalClinicIdrequiredstringYour own clinic code. You choose the format — just keep it stable.
clinicNamestringOptional, for your own reference and for the error message when the code is not mapped. The API never creates a clinic.

Plan

FieldTypeDescription
externalPlanIdstringRe-sending updates the same plan.
namerequiredstringPlan name.
notestring—

items[]

Only name is required. Every classification field falls back to a sane default rather than rejecting the item.

FieldTypeDescription
items[].namerequiredstringFood name, free text.
items[].sanskritstring—
items[].groupenumgrains · legumes · vegetables · fruits · spices · dairy · oils · nuts_seeds · sweeteners · beverages · animal · condiments · prepared. Anything else falls back to prepared.
items[].viryaenumheating / cooling / neutral.
items[].gunaenumsattvic / rajasic / tamasic.
items[].doshaobject{ vata, pitta, kapha }, each favor / moderate / avoid / neutral.
curl -X POST 'https://medhas.co.in/api/external/v1/organizations/diet-plans' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"externalClinicId":"PUNE-07","externalPlanId":"DIET-118","name":"Diabetic Management Plan A","items":[{"name":"Bitter Gourd Soup","group":"prepared"},{"name":"Steamed Millets","group":"grains"}]}'
Response · 200
{
  "externalPlanId": "DIET-118",
  "status": "created",
  "id": "66f1a2b3c4d5e6f7a8b9c0d4"
}
Try itAdd your API key at the top of the page to enable this
/api/external/v1/organizations/diet-plans

Lab results

Lab report values — blood work, vitals, any metric you track — for trend charts and research.

POST/api/external/v1/organizations/lab-results

Send a lab report

Records one report’s worth of lab values for a patient — the same destination as a doctor typing results into the app, so they show up in trend charts, research and the AI assistant immediately.

idempotent on clinic + patient + reportDate

Routing

FieldTypeDescription
externalClinicIdrequiredstringYour own clinic code. You choose the format — just keep it stable.
clinicNamestringOptional, for your own reference and for the error message when the code is not mapped. The API never creates a clinic.

Report

FieldTypeDescription
reportDaterequireddateYYYY-MM-DD. Resending this date merges into the same report instead of creating a duplicate.

patient

The identity key is externalId — sending it again updates the same patient rather than creating a second one.

FieldTypeDescription
patient.externalIdrequiredstringYour patient id.
patient.namestring—
patient.sexstringM / F / O.
patient.ageYearsnumber—
patient.dobdateYYYY-MM-DD.
patient.mobilestring—

values

An object keyed by metric name — letters, digits and underscore only. Recognized keys (hba1c, glucose_fasting, systolic_bp, diastolic_bp, hemoglobin, and more) get a friendly label and unit automatically; any other key is stored and labeled as sent. Each value is a number or short text (under 200 characters). 1–100 entries per report.

FieldTypeDescription
values.<metricKey>requirednumber | stringOne entry per lab value on this report, e.g. values.hba1c, values.systolic_bp.
curl -X POST 'https://medhas.co.in/api/external/v1/organizations/lab-results' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"externalClinicId":"PUNE-07","reportDate":"2026-01-15","patient":{"externalId":"P-10234","name":"Ravi Kumar"},"values":{"hba1c":7.2,"glucose_fasting":118,"systolic_bp":130,"diastolic_bp":85,"notes":"Sample slightly hemolyzed"}}'
Response · 200
{
  "status": "created",
  "clinicId": "66f1a2b3c4d5e6f7a8b9c0d1",
  "patientId": "66f1a2b3c4d5e6f7a8b9c0d2",
  "reportDate": "2026-01-15",
  "metricCount": 5
}
Try itAdd your API key at the top of the page to enable this
/api/external/v1/organizations/lab-results
POST/api/external/v1/organizations/lab-results/batch

Send a batch of lab reports

Up to 500 reports per request. Each record is processed independently — one bad record never fails the rest.

max 500 per requestidempotent on clinic + patient + reportDate

Body

FieldTypeDescription
reports[]requiredarrayEach element uses exactly the same shape as the single-report endpoint above.
curl -X POST 'https://medhas.co.in/api/external/v1/organizations/lab-results/batch' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"reports":[{"externalClinicId":"PUNE-07","reportDate":"2026-01-15","patient":{"externalId":"P-1","name":"Meera Nair"},"values":{"hemoglobin":12.4,"wbc":6400}},{"externalClinicId":"PUNE-07","reportDate":"2026-01-15","patient":{"externalId":"P-2","name":"Arjun Shetty"},"values":{"systolic_bp":142,"diastolic_bp":92}}]}'
Response · 200
{
  "results": [
    {
      "status": "created",
      "clinicId": "…",
      "patientId": "…",
      "reportDate": "2026-01-15",
      "metricCount": 2
    },
    {
      "status": "created",
      "clinicId": "…",
      "patientId": "…",
      "reportDate": "2026-01-15",
      "metricCount": 2
    }
  ],
  "summary": {
    "received": 2,
    "created": 2
  }
}
Try itAdd your API key at the top of the page to enable this
/api/external/v1/organizations/lab-results/batch

Dravyas

Ayurvedic drugs and the classical combinations built from them — shared across your whole organization, optionally dispensed straight into a clinic’s inventory.

POST/api/external/v1/organizations/moolikas

Create or update a herb (Dravya)

Registers one raw herb into your organization’s shared Dravya catalog, the ingredient list combinations are built from. Unlike visits/inventory/diet/lab-results, this is organization-scoped, not per-clinic: no externalClinicId routing is needed, and every clinic in the org sees and can edit the same catalog. Your externalHerbId is what finds the herb again. An update changes only the fields you send, so a sync of two columns leaves the rest of the herb, and its safety flags, as they were.

idempotent on externalHerbId

Matching and updates

Changed on 30 October 2026. A name no longer finds a record, an update no longer replaces the whole record, and a record that names an existing one without its external id is now refused instead of overwriting it.

FieldTypeDescription
externalHerbIdstringYour herb id, and the only thing that finds a herb. Re-sending it updates that herb. Without it a record can only create: the herb cannot be updated from your side afterwards, and re-sending the same name is refused.
adoptHerbIdstringThe MEDHAS id of a herb already in the catalog (a seeded one, say), to link your externalHerbId to it. Use it on the first sync of that herb: a duplicate refusal gives the id as existingId. Only the fields you send change. Refused without externalHerbId, when either side is already linked elsewhere, or when the herb is archived.

Herb

Only fields you send change: leave one out, or send null, and it keeps its value. To empty a field send "" or []. A name already in the catalog, with case, accents and spacing ignored, is refused with 409 and code duplicate, within a batch too; an archived herb does not hold its name. An update to a herb the clinic archived is refused with 409 and code archived. A value over its limit (name 200 characters, dose 300, karma, uses, notes and cautions 1000) is refused with code too_long, never cut. A value outside a listed choice is refused with code invalid, never replaced.

FieldTypeDescription
namestringRequired to create a herb. On an update it renames the herb, and the recipes that use it.
nameIaststringThe name in IAST.
botanicalNamestring—
sanskritstring—
partUsedstringRoot, leaf, bark, seed, etc.
rasaarrayTaste(s): madhura, amla, lavana, katu, tikta, kashaya.
gunastringProperty, e.g. laghu, snigdha.
doshaobject{ vata, pitta, kapha }, each increase / decrease / neutral. On an update only the doshas you name change.
viryastring—
vipakastring—
prabhavastring—
karmastring—
usesstring—
dosestring—
kindstringplant / mineral / animal / salt / sugar / liquid / formulation. A new herb defaults to plant.
englishNamestring—
aliasesarrayOther names and spellings; search matches them. A sync does not.
processedFormstringe.g. bhasma, kshara, sattva.
varietiesarray—
substitutesarray—
requiresShodhanabooleanTrue when it must be purified before use. Must be true or false: leaving it out keeps the flag, and false clears it.
toxicityClassstringvisha / upavisha / rasa, when it is one.
scheduleE1booleanTrue for a Schedule E(1) drug. True or false only.
pregnancyCautionbooleanTrue when it needs caution in pregnancy. True or false only.
cautionsstringAnything else a doctor should see when choosing it.
conservationstringcites or wpa, when it is listed.
sourcestringSupplier or origin.
notesstring—

Response

FieldTypeDescription
statusstringcreated, updated or error.
idstringThe MEDHAS id of the herb.
errorstringWhat went wrong and what to do, in plain English.
codestringduplicate (name in use, nothing changed), archived (the clinic removed this record, nothing changed; it must be restored in the app first), too_long, invalid, missing_scope, or stale. A code is not always present.
fieldstringThe field at fault, with too_long and invalid.
limitnumberThe longest value allowed, with too_long.
existingId / existingNamestringThe record holding the name, with duplicate. Send existingId as the adopt field to sync with it.
curl -X POST 'https://medhas.co.in/api/external/v1/organizations/moolikas' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"externalHerbId":"HERB-ASH-01","name":"Ashwagandha","botanicalName":"Withania somnifera","sanskrit":"Ashwagandha","partUsed":"Root","rasa":["tikta","kashaya"],"dosha":{"vata":"decrease","kapha":"increase"}}'
Response · 200
{
  "externalHerbId": "HERB-ASH-01",
  "status": "created",
  "id": "66f1a2b3c4d5e6f7a8b9c0d5"
}
Try itAdd your API key at the top of the page to enable this
/api/external/v1/organizations/moolikas
POST/api/external/v1/organizations/moolikas/batch

Sync a batch of herbs

Up to 500 herbs per request. Each record is processed independently: one bad record never fails the rest. Two records of one batch with the same new name make one herb; the second is refused as a duplicate.

max 500 per requestidempotent on externalHerbId

Body

FieldTypeDescription
herbs[]requiredarrayEach element uses exactly the same shape as the single-herb endpoint above.
curl -X POST 'https://medhas.co.in/api/external/v1/organizations/moolikas/batch' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"herbs":[{"externalHerbId":"HERB-TUL-01","name":"Tulsi","botanicalName":"Ocimum sanctum"},{"externalHerbId":"HERB-PUN-01","name":"Punarnava","botanicalName":"Boerhavia diffusa"}]}'
Response · 200
{
  "results": [
    {
      "externalHerbId": "HERB-TUL-01",
      "status": "created",
      "id": "…"
    },
    {
      "externalHerbId": "HERB-PUN-01",
      "status": "created",
      "id": "…"
    }
  ],
  "summary": {
    "received": 2,
    "created": 2
  }
}
Try itAdd your API key at the top of the page to enable this
/api/external/v1/organizations/moolikas/batch
POST/api/external/v1/organizations/moolika-combinations

Create or update a herb combination

Builds a formulation (Kashayam, Choornam, Rasayana, ...) from herbs in your organization’s shared Dravya catalog. Also organization-scoped, not per-clinic. Sync your herbs first: a recipe line finds its herb by externalHerbId, and a line that finds none is saved by name and listed in unresolvedHerbs. No herb is ever created from a recipe. Set autoDispense with externalClinicId to also add the result to that clinic’s medicine inventory in the same call; that needs the API key’s inventory scope beside moolika-combinations.

idempotent on externalCombinationId

Matching and updates

Changed on 30 October 2026. A name no longer finds a record, an update no longer replaces the whole record, and a record that names an existing one without its external id is now refused instead of overwriting it. A recipe line no longer creates a herb, must say its quantity, and autoDispense now needs the inventory scope.

FieldTypeDescription
externalCombinationIdstringYour combination id, and the only thing that finds a combination. Re-sending it updates that combination. Without it a record can only create, and re-sending the same name and variant is refused, so a retry cannot make a second copy. Send it.
adoptCombinationIdstringThe MEDHAS id of a combination already in the catalog, to link your externalCombinationId to it. A duplicate refusal gives the id as existingId. Only the fields you send change.

Combination

Only fields you send change: leave one out, or send null, and it keeps its value. herbs, when sent, replaces the whole recipe. A name and variant already in the catalog, with case, accents and spacing ignored, is refused with 409 and code duplicate. An update to a combination the clinic archived is refused with 409 and code archived. A value over its limit (name 150 characters, indication and dosage 300, notes 2000, method 5000) is refused with code too_long, never cut. A value outside a listed choice is refused with code invalid, never replaced.

FieldTypeDescription
namestringRequired to create a combination.
nameIaststringThe name in IAST.
variantstringTells apart two recipes of one name.
preparationTypestringkashayam / choornam / kwath / rasayana / arishta / ghrita / taila / vati / avaleha / guggulu / bhasma / pishti / kupipakva / parpati / rasa-yoga / lauha / mandura / lavana-kshara / lepa / varti-anjana / arka / dravaka / sattva / other. A new combination defaults to other.
indicationstring—
indicationsarrayThe same, as separate entries. Read from indication when not sent.
dosagestring—
anupanastringVehicle it’s taken with, e.g. warm water, honey.
categorystringFormulary group id, e.g. asava-arishta, taila, churna, vati, bhasma.
routestringinternal / external / both.
methodstringHow it is prepared.
preservationstringHow long it keeps and how it is stored.
aliasesarray—
diseasesarrayDisease terms it is indexed under.
footnotesarrayFootnotes from the source text.
notesstring—
autoDispensebooleanWhen true, also adds the saved combination to a clinic’s medicine inventory as a stock item. The API key needs the inventory scope, or the whole record is refused with 403 and nothing is saved.

Dispensing (only used with autoDispense)

The combination is saved first. If the stock cannot be added, the record still says created or updated and the reason is in dispense; re-send to try again. A stock row that already exists is reused and its count is not changed: use the inventory endpoint for that.

FieldTypeDescription
externalClinicIdstringYour own clinic code. You choose the format — just keep it stable. Required with autoDispense: a clinicName alone does not find a clinic.
clinicNamestringOptional, for your own reference and for the error message when the code is not mapped. The API never creates a clinic. Only read when autoDispense is true.
stocknumberThe opening count of a new stock row. Defaults to 0.
mrpnumberMRP of a new stock row. Without a price the row is saved, and dispense.warning says the pharmacy will not bill it until it has one.
sellRatenumberSelling rate of a new stock row. Not above the MRP.
minimumStocknumberThe reorder level of a new stock row.
expDatedateExpiry of the opening stock. Opening stock above 0 needs this, or noExpiry.
noExpirybooleanTrue for a preparation with no expiry, such as an Asava.

herbs[]

A line finds its herb by externalHerbId. A name finds nothing, with one exception: a re-sent line keeps the herb the recipe already had under that name. A line that finds no herb is kept with its name and no link, and is listed in unresolvedHerbs; send the line again with an externalHerbId once the herb is synced. A line with no herb adds no safety warning to the recipe, so read that list. A recipe holds up to 100 lines.

FieldTypeDescription
herbs[].externalHerbIdstringThe herb, as you synced it to the herbs endpoint.
herbs[].namestringRequired unless externalHerbId finds a herb, which then gives the name.
herbs[].quantityrequirednumberAbove zero: 2, 2.5, "0,5" or "1/2". A line without one, or with anything else, refuses the record with code invalid: a recipe is never saved with a quantity nobody entered. Only the unit q.s. needs none.
herbs[].unitstringpart, g, mg, kg, ml, l, No., q.s., ratti, masha, karsha, tola, shukti, pala, prasriti, kudava, manika, prastha, adhaka, tula, drona, shurpa, droni, bhara, khari. Defaults to "part". Anything else refuses the record with code invalid, unless that line already stores it.
herbs[].rolestringmain / liquid / prakshepa / bhavana / pralepana / dhupana / other. Defaults to main.
herbs[].partstringPart of the plant, e.g. Root.
herbs[].processedFormstringe.g. kshara, churna, shodhita.
herbs[].asWrittenstringThe line as the source wrote it.
herbs[].reducedTostringThe volume a liquid is reduced to, as the source gives it, e.g. 3.072 l.
herbs[].groupbooleanTrue when the line’s quantity is shared by a group of drugs, as in “drugs 1 to 17 in equal proportion”.
herbs[].uncertainbooleanTrue when the source could not be read with certainty. The screens mark the line “Check”.

Response

FieldTypeDescription
statusstringcreated, updated or error.
idstringThe MEDHAS id of the combination.
unresolvedHerbs[]array{ line, name, externalHerbId, reason } for every line saved with no herb behind it. Empty when all resolved or when herbs was not sent.
inventoryItemIdstringThe stock row in the clinic, or null.
dispenseobjectPresent with autoDispense. status is created, reused or failed. A failed one carries code (clinic_required, clinic_not_mapped, expiry_required, dispense_failed) and error; a reused one carries stockIgnored when you sent a stock; either kind that succeeded may carry a warning, such as a row with no price. A batch counts these in summary.dispenseFailed.
errorstringWhat went wrong and what to do, in plain English.
codestringduplicate (name in use, nothing changed), archived (the clinic removed this record, nothing changed; it must be restored in the app first), too_long, invalid, missing_scope, or stale. A code is not always present.
fieldstringThe field at fault, with too_long and invalid.
limitnumberThe longest value allowed, with too_long.
existingId / existingNamestringThe record holding the name, with duplicate. Send existingId as the adopt field to sync with it.
curl -X POST 'https://medhas.co.in/api/external/v1/organizations/moolika-combinations' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"externalClinicId":"PUNE-07","externalCombinationId":"COMBO-DASHA-01","name":"Dashamoola Kashayam","preparationType":"kashayam","indication":"Vata disorders, postpartum care","dosage":"15ml twice daily before food","anupana":"Warm water","herbs":[{"externalHerbId":"HERB-BIL-01","name":"Bilva","quantity":1,"unit":"part"},{"externalHerbId":"HERB-SHY-01","name":"Shyonaka","quantity":1,"unit":"part"}],"autoDispense":true,"stock":20,"expDate":"2028-12-31"}'
Response · 200
{
  "externalCombinationId": "COMBO-DASHA-01",
  "status": "created",
  "id": "66f1a2b3c4d5e6f7a8b9c0d6",
  "inventoryItemId": "66f1a2b3c4d5e6f7a8b9c0d7",
  "unresolvedHerbs": [
    {
      "line": 1,
      "name": "Shyonaka",
      "externalHerbId": "HERB-SHY-01",
      "reason": "No herb has this externalHerbId yet."
    }
  ],
  "dispense": {
    "status": "created",
    "inventoryItemId": "66f1a2b3c4d5e6f7a8b9c0d7"
  }
}
Try itAdd your API key at the top of the page to enable this
/api/external/v1/organizations/moolika-combinations
POST/api/external/v1/organizations/moolika-combinations/batch

Sync a batch of herb combinations

Up to 500 combinations per request. Each record is processed independently: one bad record never fails the rest. A record with autoDispense from a key without the inventory scope is refused on its own; the others go through.

max 500 per requestidempotent on externalCombinationId

Body

FieldTypeDescription
combinations[]requiredarrayEach element uses exactly the same shape as the single-combination endpoint above.
curl -X POST 'https://medhas.co.in/api/external/v1/organizations/moolika-combinations/batch' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"combinations":[{"externalCombinationId":"COMBO-TRI-01","name":"Triphala Choornam","preparationType":"choornam","herbs":[{"externalHerbId":"HERB-AMA-01","name":"Amalaki","quantity":1,"unit":"part"},{"externalHerbId":"HERB-BIB-01","name":"Bibhitaki","quantity":1,"unit":"part"},{"externalHerbId":"HERB-HAR-01","name":"Haritaki","quantity":1,"unit":"part"}]}]}'
Response · 200
{
  "results": [
    {
      "externalCombinationId": "COMBO-TRI-01",
      "status": "created",
      "id": "…",
      "inventoryItemId": null,
      "unresolvedHerbs": []
    }
  ],
  "summary": {
    "received": 1,
    "created": 1
  }
}
Try itAdd your API key at the top of the page to enable this
/api/external/v1/organizations/moolika-combinations/batch

Responses & retries

Ingestion endpoints report an outcome per record, never a single pass/fail for a whole batch.

Record statusMeaning
createdA new record was inserted.
updatedAn existing record with the same external id was found and updated in place.
errorThis one record was rejected — read its error string. Other records in the batch are unaffected.

Retrying safely

Every endpoint is idempotent when you supply an external id — externalVisitId,externalItemId or externalPlanId. If a request times out or you cannot tell whether it landed, send it again unchanged: you will get updated rather than a duplicate. Records sent without an external id are always inserted as new, so set one wherever you can. Lab results have no separate id to set — the report date itself is the key, so resending the same clinic/patient/date always merges into that one report rather than duplicating it.

What happens to your data

  • Symptom severity is normalized to 0–10 and feeds trend charts and the AI assistant exactly like an assessment typed in at the clinic.
  • Medicine names are matched against your organization’s product catalog for adoption reporting. Matching is exact on name, so consistent naming between your visit and inventory records improves accuracy.
  • Doctors identified by externalDoctorId get an attribution record — not a login — so per-prescriber reporting includes your data without provisioning accounts.
  • Clinics created from the API (when your organization allows it) can be renamed or remapped later by your organization admin without affecting data already ingested.
  • Lab values land in the same place a doctor typing results into the app writes to, so they appear on the patient’s report history and trend charts immediately — recognized metric keys (e.g. hba1c, systolic_bp) get a proper label and unit; unrecognized ones are still stored, labeled as sent.

Organization Data API · v1 · Questions about your API key or clinic mapping go to your MEDHAS platform contact.