Skip to content

Adjust Stock

Records a stock movement against an inventory record. Every adjustment is logged to the Inventory Log with the action type, the user who made it, and an optional reference.

Endpoint

PATCH /v1/inventory/{id}/adjust

Required Headers

json
{
  "Authorization": "Bearer JWT_TOKEN",
  "X-MerchantApiKey": "MERCHANT_API_KEY",
  "Content-Type": "application/json"
}

Path Parameters

ParameterDescription
idThe ID of the inventory record to adjust.

Request Parameters

FieldTypeRequiredDescription
qtyintegerYesThe quantity to change. Use a positive number to add stock, a negative number to remove stock.
actionstringYesThe reason for the stock change. See action types below.
referencestringNoAn external reference such as an order ID or purchase order number.
notesstringNoA human-readable note explaining the adjustment.

Stock Action Types

ActionWhen to Use
RECEIVEDStock received from a supplier or purchase order.
SOLDStock consumed by a fulfilled customer order.
ADJUSTEDManual correction to fix a discrepancy (e.g., after a physical count).
DAMAGEDStock written off as damaged or scrapped.
RETURNEDStock returned by a customer.

Note: RESERVED and RELEASED are managed through the dedicated Reserve & Release endpoints, not here.

📥 Request Samples

Receiving new stock from a supplier

json
{
  "qty": 100,
  "action": "RECEIVED",
  "reference": "PO-2024-0042",
  "notes": "November restock from supplier"
}

Writing off damaged goods

json
{
  "qty": -3,
  "action": "DAMAGED",
  "notes": "3 units damaged during transit"
}

Manual correction after stock count

json
{
  "qty": -2,
  "action": "ADJUSTED",
  "notes": "Physical count showed 2 fewer units than system record"
}

✅ Sample 200 Response (Success)

json
{
  "status": true,
  "data": {
    "id": "inv_xyz789",
    "productId": "prod_abc123",
    "warehouseId": "wh_abc123",
    "warehouseName": "Lagos Main Warehouse",
    "onHandQty": 200,
    "reservedQty": 5,
    "availableQty": 195,
    "lastStockAdjusted": "2024-12-01T14:30:00Z",
    "lastAdjustedBy": "user_merchant_001"
  }
}

❌ Sample Error Response

json
{
  "status": false,
  "message": "Adjustment would result in negative stock. Current on-hand: 3, requested change: -5."
}

Next Steps

Build with joy