Skip to main content

Inventory

Get Inventory by Product

curl -X GET "${VITE_BASE_URL}/inventory/product/1" \
  -H "Authorization: Bearer <token>"
Retrieves inventory information for a specific product across all warehouses. Authentication Required: Yes

Path Parameters

productId
number
required
Product ID to retrieve inventory for

Response

product_id
number
Product unique identifier
product
object
Product information
id
number
Product ID
name
string
Product name
sku
string
Product SKU
total_quantity
number
Total quantity across all warehouses
warehouses
array
Inventory breakdown by warehouse
warehouse_id
number
Warehouse ID
warehouse_name
string
Warehouse name
quantity
number
Available quantity in this warehouse
reserved
number
Reserved quantity (for pending orders)
available
number
Available quantity (quantity - reserved)
min_stock
number
Minimum stock level
max_stock
number
Maximum stock level
reorder_point
number
Reorder point threshold
{
  "product_id": 1,
  "product": {
    "id": 1,
    "name": "T-Shirt Premium",
    "sku": "TSH-001"
  },
  "total_quantity": 450,
  "warehouses": [
    {
      "warehouse_id": 1,
      "warehouse_name": "Almacén Principal",
      "quantity": 300,
      "reserved": 50,
      "available": 250,
      "min_stock": 100,
      "max_stock": 500,
      "reorder_point": 150
    },
    {
      "warehouse_id": 2,
      "warehouse_name": "Almacén Monterrey",
      "quantity": 150,
      "reserved": 20,
      "available": 130,
      "min_stock": 50,
      "max_stock": 300,
      "reorder_point": 75
    }
  ]
}

Create Inventory Record

curl -X POST "${VITE_BASE_URL}/inventory" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": 1,
    "warehouse_id": 1,
    "quantity": 100,
    "min_stock": 50,
    "max_stock": 500,
    "reorder_point": 100
  }'
Creates a new inventory record for a product in a specific warehouse. Authentication Required: Yes

Request Body

product_id
number
required
Product ID
warehouse_id
number
required
Warehouse ID
quantity
number
required
Initial quantity
min_stock
number
Minimum stock level for alerts
max_stock
number
Maximum stock level
reorder_point
number
Quantity threshold to trigger reorder
location
string
Physical location within warehouse (e.g., “Aisle 3, Shelf B”)

Response

id
number
Created inventory record ID
message
string
Success message
{
  "id": 42,
  "message": "Inventory record created successfully"
}

Update Inventory

curl -X PUT "${VITE_BASE_URL}/inventory/42" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "quantity": 150,
    "operation": "adjustment",
    "reason": "Physical count adjustment"
  }'
Updates an inventory record. Authentication Required: Yes

Path Parameters

id
number
required
Inventory record ID to update

Request Body

quantity
number
New quantity (for adjustments)
operation
string
Operation type:
  • adjustment: Manual adjustment
  • receive: Receiving stock
  • ship: Shipping stock
  • transfer: Transfer between warehouses
  • return: Customer return
quantity_change
number
Quantity to add (positive) or subtract (negative)
reason
string
Reason for the inventory change
reference
string
Reference number (PO number, transfer number, etc.)
min_stock
number
Update minimum stock level
max_stock
number
Update maximum stock level
reorder_point
number
Update reorder point
location
string
Update physical location

Response

message
string
Success message
previous_quantity
number
Quantity before update
new_quantity
number
Quantity after update
transaction_id
number
Inventory transaction record ID
{
  "message": "Inventory updated successfully",
  "previous_quantity": 100,
  "new_quantity": 150,
  "transaction_id": 1523
}

Inventory Movements

All inventory updates create transaction records for audit purposes. These movements track:
  • Operation Type: What caused the inventory change
  • User: Who made the change
  • Timestamp: When the change occurred
  • Quantity Change: Amount added or removed
  • Reference: Related document numbers
  • Reason: Explanation for the change

Common Operations

Receive Stock

Add inventory when receiving new stock from suppliers

Ship Stock

Reduce inventory when fulfilling orders

Adjust

Manual adjustments for physical counts or corrections

Transfer

Move inventory between warehouses

Low Stock Alerts

The system automatically monitors inventory levels:
  • Warning: When quantity falls below reorder_point
  • Critical: When quantity falls below min_stock
  • Overstocked: When quantity exceeds max_stock
Configure these thresholds when creating or updating inventory records to receive automated alerts.

Build docs developers (and LLMs) love