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

Create a return

Any signed in user. Restocks units, records the RETURN movement, and raises the credit note. A sale from another branch gets 403, and returning more units than a line has left gets 400.

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

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

Request body
requiredapplication/json
sale_idstringrequired
min length 1
itemsobject[]required
min items 1
Show properties
Array of object
sale_item_idstringrequired
min length 1
quantitynumber | stringrequired
restockableboolean
reasonstring
reasonstring
client_mutation_idstring
device_idstring | null
Responses
201

Return processed

return_idstringrequired
credit_note_numberstringrequired
total_refundstringrequired
items_returnedintegerrequired
min -9007199254740991 · max 9007199254740991
created_atstringrequired
400

sale_id is missing, no items were supplied, a line is not on this sale, a line quantity is not positive, or a line asks for more than its returnable quantity

detailstringrequired
401

Not authenticated

detailstringrequired
403

Sale belongs to a different branch

detailstringrequired
404

Sale not found

detailstringrequired
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST 'http://localhost:8000/api/v1/returns' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "sale_id": "string",
  "items": [
    {
      "sale_item_id": "string",
      "quantity": 0,
      "restockable": true,
      "reason": "string"
    }
  ],
  "reason": "string",
  "client_mutation_id": "string",
  "device_id": "string"
}'
Response
{
  "return_id": "string",
  "credit_note_number": "string",
  "total_refund": "string",
  "items_returned": -9007199254740991,
  "created_at": "string"
}