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

Receive a purchase order

Admin and branch manager. Books received lines into batches, closing the order as RECEIVED. An already received or cancelled order is refused with 400, so nothing is booked twice.

POST/api/v1/purchase-orders/{purchaseOrderId}/receive
Authorization
AuthorizationBearer token (JWT) · headerrequired

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

Path parameters
purchaseOrderIdstringrequired

The purchase order being received.

Request body
requiredapplication/json
itemsobject[]required
min items 1
Show properties
Array of object
medicine_idstringrequired
min length 1
batch_numberstringrequired
min length 1
qty_receivedintegerrequired
min -9007199254740991 · max 9007199254740991
unit_costnumberrequired
expiry_datestringrequired
min length 1
manufacturing_datestring | null
Responses
200

The purchase order is received

idstringrequired
statusstringrequired
batches_createdintegerrequired
min -9007199254740991 · max 9007199254740991
400

The request body fails validation, the PO is already received, or it is cancelled

detailstringrequired
401

Not authenticated

detailstringrequired
403

Access forbidden for this role

detailstringrequired
404

PO not found

detailstringrequired
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST 'http://localhost:8000/api/v1/purchase-orders/string/receive' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "items": [
    {
      "medicine_id": "string",
      "batch_number": "string",
      "qty_received": -9007199254740991,
      "unit_cost": 0,
      "expiry_date": "string",
      "manufacturing_date": "string"
    }
  ]
}'
Response
{
  "id": "string",
  "status": "string",
  "batches_created": -9007199254740991
}