在庫移動 API

倉庫間の在庫移動を追跡・記録します。すべての在庫変動は移動として記録されます。

エンドポイント
GET

/stock-movements

stock_movements:read

ページネーション付きの在庫移動一覧を取得します。商品、倉庫、タイプ、日付範囲でのフィルタに対応。

POST

/stock-movements

stock_movements:write

新しい在庫移動を記録します。在庫数量は自動的に更新されます。

フィールドリファレンス
フィールド必須説明

id

string

いいえ

一意の在庫移動識別子(読み取り専用)

productId

string

はい

商品識別子

productSku

string

いいえ

商品 SKU(読み取り専用)

productName

string

いいえ

商品名(読み取り専用)

warehouseId

string

はい

倉庫識別子

warehouseName

string

いいえ

倉庫名(読み取り専用)

variantId

string

いいえ

商品バリアント識別子(該当する場合)

quantity

integer

はい

移動数量(正の整数)

movementType

string

はい

IN、OUT、ADJUSTMENT、TRANSFER_OUT、または TRANSFER_IN

reference

string

いいえ

参照番号(例:発注書番号)

unitCost

integer

いいえ

単価(セント単位)

batchNumber

string

いいえ

バッチ番号

notes

string

いいえ

補足メモ

createdAt

datetime

いいえ

ISO 8601 タイムスタンプ(読み取り専用)

クエリパラメータ(一覧)
フィールド必須説明

page

integer

いいえ

ページ番号(デフォルト:1)

limit

integer

いいえ

1ページあたりの件数(デフォルト:20、最大:100)

productId

string

いいえ

商品 ID でフィルタ

warehouseId

string

いいえ

倉庫 ID でフィルタ

movementType

string

いいえ

タイプでフィルタ:IN、OUT、ADJUSTMENT、TRANSFER_OUT、TRANSFER_IN

from

string

いいえ

開始日フィルタ(ISO 8601)

to

string

いいえ

終了日フィルタ(ISO 8601)

使用例
在庫移動一覧を取得
bash
curl "https://api.mercozy.com/api/v1/external/stock-movements?page=1&limit=20&movementType=IN" \
  -H "X-API-Key: mk_live_xxxxx"
在庫移動を作成
bash
curl -X POST "https://api.mercozy.com/api/v1/external/stock-movements" \
  -H "X-API-Key: mk_live_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "productId": "product-uuid",
    "warehouseId": "warehouse-uuid",
    "quantity": 100,
    "movementType": "IN",
    "reference": "PO-2024-001",
    "notes": "Initial stock"
  }'
レスポンス例
json
{
  "data": {
    "id": "sm_abc123",
    "productId": "product-uuid",
    "productSku": "WDG-001",
    "productName": "Premium Widget",
    "warehouseId": "warehouse-uuid",
    "warehouseName": "Main Warehouse",
    "variantId": null,
    "quantity": 100,
    "movementType": "IN",
    "reference": "PO-2024-001",
    "unitCost": null,
    "batchNumber": null,
    "notes": "Initial stock",
    "createdAt": "2025-12-15T10:30:00Z"
  }
}