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:
| Field | Type | Required | Description |
|---|
inventoryItemId | string | Yes | Inventory item ID to adjust |
newQtyOnHand | number | Yes | New quantity on hand |
reasonCodeId | string | Yes | Reason code for the adjustment |
comment | string | No | Optional comment |
rootCause | string | No | Required 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:
| Parameter | Type | Required | Description |
|---|
inventoryItemId | string | No | Filter by inventory item |
productMasterId | string | No | Filter by product |
locationId | string | No | Filter by location |
startDate | string | No | Filter from date (ISO format) |
endDate | string | No | Filter to date (ISO format) |
limit | integer | No | Maximum results (default: 50) |
offset | integer | No | Offset 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.
Related Pages
Permissions & Roles
Creating adjustments requires inventory management permissions. Some adjustments may require approval.