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

Create a batch stock transfer

Admin or branch manager. Moves several medicines between two branches in one atomic request. Every line is in one transaction, so one failure rolls it back, and branches must differ.

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

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

Request body
requiredapplication/json
from_branch_idstringrequired
min length 1
to_branch_idstringrequired
min length 1
notesstring
default: ""
itemsobject[]required
min items 1
Show properties
Array of object
medicine_idstringrequired
min length 1
qtyintegerrequired
min -9007199254740991 · max 9007199254740991
Responses
201

Every line moved

itemsobject[]required
Show properties
Array of object
idstringrequired
medicine_idstringrequired
medicine_namestringrequired
qtyintegerrequired
min -9007199254740991 · max 9007199254740991
created_atstringrequired
totalintegerrequired
min -9007199254740991 · max 9007199254740991
400

A line quantity is not positive, both branches are the same, the source has insufficient stock, or no source batch is available

detailstringrequired
401

Not authenticated

detailstringrequired
403

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

detailstringrequired
404

A medicine, the source branch, or the destination branch was not found

detailstringrequired
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST 'http://localhost:8000/api/v1/transfers/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "from_branch_id": "string",
  "to_branch_id": "string",
  "notes": "",
  "items": [
    {
      "medicine_id": "string",
      "qty": -9007199254740991
    }
  ]
}'
Response
{
  "items": [
    {
      "id": "string",
      "medicine_id": "string",
      "medicine_name": "string",
      "qty": -9007199254740991,
      "created_at": "string"
    }
  ],
  "total": -9007199254740991
}