庫存 API

即時監控各倉庫的庫存水平。

端點列表
GET

/inventory

inventory:read

取得所有商品的庫存水平。支援按倉庫和低庫存狀態篩選。

GET

/inventory/:productId

inventory:read

取得特定商品在所有倉庫的庫存資訊。

欄位參考
欄位類型必填描述

id

string

否

唯一庫存記錄ID(唯讀)

productId

string

否

商品識別碼

productSku

string

否

產品SKU

productName

string

否

商品名稱(唯讀)

warehouseId

string

否

倉庫識別碼

warehouseName

string

否

倉庫名稱(唯讀)

quantity

integer

否

目前庫存數量

reservedQuantity

integer

否

待處理訂單預留數量

availableQuantity

integer

否

可用數量(數量減去預留)

minThreshold

integer

否

低庫存預警閾值

updatedAt

datetime

否

最近庫存更新時間戳

查詢參數(列表)
欄位類型必填描述

page

integer

否

頁碼(預設:1)

limit

integer

否

每頁筆數(預設:20,最大:100)

warehouseId

string

否

按倉庫 ID 篩選

lowStock

boolean

否

僅顯示低於預警閾值的商品

範例
取得庫存水平
bash
curl "https://api.mercozy.com/api/v1/external/inventory?lowStock=true" \
  -H "X-API-Key: mk_live_your_key_here"
取得特定商品庫存
bash
curl "https://api.mercozy.com/api/v1/external/inventory/prod_abc123" \
  -H "X-API-Key: mk_live_your_key_here"
回應範例
json
{
  "data": {
    "productId": "prod_abc123",
    "productName": "Premium Widget",
    "sku": "WDG-001",
    "quantity": 42,
    "lowStockThreshold": 10,
    "warehouseId": "wh_main",
    "warehouseName": "Main Warehouse",
    "updatedAt": "2025-12-15T10:30:00Z"
  }
}