Skip to content
PharmaFlow
Esc
↑↓navigate↵open⌘Jpreview

Import medicines from a CSV or Excel file

Admin, inventory manager, or branch manager. Reads a CSV or an Excel file and upserts the medicines in one transaction. Barcodes already in the catalogue can be skipped, and every row is judged on its own: the valid rows are imported while each row without a name is reported back with its row number so it can be corrected and resent. Images are not imported from the file.

POST/api/v1/medicines/import
Authorization
AuthorizationBearer token (JWT) · headerrequired

JWT from POST /api/v1/auth/login sent as Authorization Bearer.

Request body
requiredtext/csv
namestringrequired
min length 1
generic_namestring
default: ""
barcodestring
default: ""
categorystring
default: ""
formstring
default: ""
strengthstring
default: ""
unitstring
default: ""
selling_pricestring
default: "0.000"
low_stock_thresholdinteger
min -9007199254740991 · max 9007199254740991 · default: 10
requires_prescriptionboolean
default: false
is_controlledboolean
default: false
vat_categorystring
default: "zero_rated"
requires_cold_chainboolean
default: false
sfda_registration_nostring
default: ""
max_public_pricestring
default: "0.000"
Responses
200

Import summary

namestringrequired
min length 1
generic_namestringrequired
default: ""
barcodestringrequired
default: ""
categorystringrequired
default: ""
formstringrequired
default: ""
strengthstringrequired
default: ""
unitstringrequired
default: ""
selling_pricestringrequired
default: "0.000"
low_stock_thresholdintegerrequired
min -9007199254740991 · max 9007199254740991 · default: 10
requires_prescriptionbooleanrequired
default: false
is_controlledbooleanrequired
default: false
vat_categorystringrequired
default: "zero_rated"
requires_cold_chainbooleanrequired
default: false
sfda_registration_nostringrequired
default: ""
max_public_pricestringrequired
default: "0.000"
400

The file body is empty, has no header row, or has no data rows

detailstringrequired
401

Not authenticated

detailstringrequired
403

Caller is not an admin, inventory manager, or branch manager

detailstringrequired
413

The file exceeds the 10 MB import limit

detailstringrequired
415

The content type is neither CSV nor Excel

detailstringrequired
Try it
Server
Authorization
Bodytext/csv
Request
curl -X POST 'https://api.pharmaflow.dev/api/v1/medicines/import' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: text/csv' \
  -d '{
  "name": "string",
  "generic_name": "",
  "barcode": "",
  "category": "",
  "form": "",
  "strength": "",
  "unit": "",
  "selling_price": "0.000",
  "low_stock_threshold": 10,
  "requires_prescription": false,
  "is_controlled": false,
  "vat_category": "zero_rated",
  "requires_cold_chain": false,
  "sfda_registration_no": "",
  "max_public_price": "0.000"
}'
Response
{
  "name": "string",
  "generic_name": "",
  "barcode": "",
  "category": "",
  "form": "",
  "strength": "",
  "unit": "",
  "selling_price": "0.000",
  "low_stock_threshold": 10,
  "requires_prescription": false,
  "is_controlled": false,
  "vat_category": "zero_rated",
  "requires_cold_chain": false,
  "sfda_registration_no": "",
  "max_public_price": "0.000"
}