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

Create a medicine

Admin, inventory manager, or branch manager. Adds a medicine and returns the stored row. Every field but the name defaults, so a sparse payload registers a medicine to price later.

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

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

Request body
requiredapplication/json
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
201

Medicine created

idstringrequired
namestringrequired
generic_namestringrequired
barcodestringrequired
categorystringrequired
formstringrequired
strengthstringrequired
unitstringrequired
selling_pricestringrequired
max_public_pricestringrequired
stock_quantityintegerrequired
min -9007199254740991 · max 9007199254740991
low_stock_thresholdintegerrequired
min -9007199254740991 · max 9007199254740991
requires_prescriptionbooleanrequired
is_controlledbooleanrequired
vat_categorystringrequired
requires_cold_chainbooleanrequired
sfda_registration_nostringrequired
image_keystringrequired
image_urlstringrequired
is_activebooleanrequired
created_atstringrequired
updated_atstringrequired
400

The body is invalid, which includes an empty medicine name

detailstringrequired
401

Not authenticated

detailstringrequired
403

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

detailstringrequired
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST 'http://localhost:8000/api/v1/medicines' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -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
{
  "id": "string",
  "name": "string",
  "generic_name": "string",
  "barcode": "string",
  "category": "string",
  "form": "string",
  "strength": "string",
  "unit": "string",
  "selling_price": "string",
  "max_public_price": "string",
  "stock_quantity": -9007199254740991,
  "low_stock_threshold": -9007199254740991,
  "requires_prescription": true,
  "is_controlled": true,
  "vat_category": "string",
  "requires_cold_chain": true,
  "sfda_registration_no": "string",
  "image_key": "string",
  "image_url": "string",
  "is_active": true,
  "created_at": "string",
  "updated_at": "string"
}