Skip to main content

Inventory Adjustments API

Scope: Tenant-scoped; requires authenticated org context
Availability: Not available in SuperAdmin

Endpoints

Create Adjustment

POST /api/inventory/adjustments Adjust inventory quantity for a stock line. Creates a stock transaction and updates the inventory item. Request Body:
{
  "inventoryItemId": "item_123",
  "newQtyOnHand": 150,
  "reasonCodeId": "reason_456",
  "comment": "Cycle count adjustment",
  "rootCause": "Physical count discrepancy"
}
Request Fields:
FieldTypeRequiredDescription
inventoryItemIdstringYesInventory item ID to adjust
newQtyOnHandnumberYesNew quantity on hand
reasonCodeIdstringYesReason code for the adjustment
commentstringNoOptional comment
rootCausestringNoRequired for healthcare large negative adjustments
Response:
{
  "success": true,
  "transaction": {
    "id": "txn_789",
    "inventoryItemId": "item_123",
    "transactionType": "ADJUSTMENT",
    "deltaQty": 50,
    "reasonCodeId": "reason_456",
    "createdAt": "2024-01-15T10:30:00Z"
  },
  "inventoryItem": {
    "id": "item_123",
    "productMasterId": "prod_123",
    "locationId": "loc_123",
    "qtyOnHand": 150,
    "qtyAvailable": 150,
    "qtyReserved": 0
  },
  "message": "Adjusted +50 units"
}

Get Adjustment History

GET /api/inventory/adjustments Get stock history and adjustment records with filtering and pagination. Query Parameters:
ParameterTypeRequiredDescription
inventoryItemIdstringNoFilter by inventory item
productMasterIdstringNoFilter by product
locationIdstringNoFilter by location
startDatestringNoFilter from date (ISO format)
endDatestringNoFilter to date (ISO format)
limitintegerNoMaximum results (default: 50)
offsetintegerNoOffset for pagination (default: 0)
Response:
{
  "entries": [
    {
      "id": "txn_789",
      "inventoryItemId": "item_123",
      "transactionType": "ADJUSTMENT",
      "deltaQty": 50,
      "qtyBefore": 100,
      "qtyAfter": 150,
      "reasonCode": "Cycle Count",
      "comment": "Physical count adjustment",
      "createdAt": "2024-01-15T10:30:00Z",
      "createdBy": "user_456"
    }
  ],
  "total": 25,
  "pagination": {
    "limit": 50,
    "offset": 0,
    "hasMore": false
  }
}

Example Requests

Create Adjustment

curl -X POST "https://app.betterdata.co/api/inventory/adjustments" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inventoryItemId": "item_123",
    "newQtyOnHand": 150,
    "reasonCodeId": "reason_456",
    "comment": "Cycle count adjustment"
  }'

Get Adjustment History

curl -X GET "https://app.betterdata.co/api/inventory/adjustments?locationId=loc_123&startDate=2024-01-01&endDate=2024-01-31&limit=50" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Common Errors

400 Bad Request

{
  "error": "inventoryItemId, newQtyOnHand, and reasonCodeId are required"
}
Cause: Missing required fields in request body. Solution: Ensure all required fields are included.

400 Adjustment Failed

{
  "error": "Adjustment failed: Insufficient permissions"
}
Cause: User lacks required permissions or adjustment validation failed. Solution: Verify user has inventory.adjust permission and check adjustment rules.

Permissions & Roles

Creating adjustments requires inventory management permissions. Some adjustments may require approval.