SKU で Resend を作成
Enterprise-only. Creates a resend by supplying warehouse-scoped SKU quantities instead of explicit return inventory IDs. The service selects eligible pending return inventory records itself (LIFO by default), then reuses the standard create-resend workflow. The whole request is processed atomically — either every requested unit is allocated and one resend is created, or nothing is.
Create resend order ではなく本エンドポイントを使う場合
- SKU と数量で在庫を管理しており、個々の
returnInventoryId値を扱いたくない場合は、SKU で Resend を作成を使用します。 - resend したい特定の
returnInventoryId値をすでに保持している場合(例:newInventoryCreatedwebhook からキャッシュ)は、Create resend order を使用します。
前提条件
- アカウントで SKU 在庫モジュール(Enterprise)が有効になっている。
- その倉庫に、要求された各 SKU について resend 対象として十分な在庫がある。まず SKU 在庫を検索(
availableQuantity)でサマリーを確認してください。ただし、サマリーチェックの通過は保証ではありません(下記参照)。 shipmentServiceTypeは Shipment Service Type(Return Service Type ではありません)。有効なコードは Warehouse で利用可能な Shipment Service Types を取得 から取得してください。
選択の仕組み
割り当ては 3 段階で行われ、権威を持つのは最後の段階のみです。- 検証。 リクエスト行が正規化され(SKU の trim + 大文字化)、重複する SKU が結合されます。検証は
warehouseId+ 正規化後 SKU ごとにavailableQuantityをチェックします。これを通過しても、サマリー上十分に見えることを確認するだけで、何も予約・割り当てされません。 - 選択。 システムは
warehouseIdと正規化 SKU に一致し、resend 対象となる実際の返品在庫レコードを照会し、ピックアップ戦略に従って要求された数量をちょうど選択します。対象レコードが要求数より少ない場合、リクエスト全体が拒否されます。 - 割り当て。 トランザクション内で、選択された行をロックして再チェックします。いずれかが対象外になっていればトランザクションをロールバックし、リクエストが失敗します。そうでなければ、選択されたすべてのレコードが resend / in-progress に進められ、同じトランザクション内で resend が作成されます。
対象条件
返品在庫レコードは、次の条件をすべて満たす場合にのみ選択対象になります。- 要求された
warehouseIdと正規化後 SKU に一致する。 handlingStatusCode= pending。- resend / in-progress に遷移できる。かつ
- 保留中の VAS がない(未完了の VAS Split を含む)。
availableQuantity より少なくなることがあります(後者は保留中の VAS を持つレコードを数える場合があります)。その場合、対象外の項目を resend するのではなく、リクエストは fail-closed で失敗します。
ピックアップ戦略
選択はデフォルトで LIFO を使用します。最新のcreateOn を優先し、タイブレークには最大の返品在庫 ID を用います。この戦略はファクトリの背後に置かれており、割り当てロジックを変更せずに将来 FIFO に切り替えられます。
エラーと再試行
- 検証失敗は HTTP 200 と
meta.status: 400で返されます(標準のソフトエラーエンベロープ。エラー処理を参照)。 - ある SKU の可用量が不足している場合、リクエストは全体として拒否されます。セキュリティのため、エラーは残りの可用量を開示しません。
- 並行リクエストが同じ在庫を奪い合う場合、レコードのロックに失敗したリクエストは拒否され、再試行できます。
関連
- SKU 在庫を検索 — リクエスト前に
availableQuantityを確認します。 - Create resend order — 明示的な返品在庫 ID で resend します。ラベル生成(自動 vs 手動サービスタイプ)とキャンセル締切もカバーしており、ここで作成される resend にも適用されます。
- Resend Order をキャンセル — 倉庫が出荷する前に中止します。
- Webhooks — resend-status-update イベントがライフサイクルの変更をエンドポイントに配信します。
承認
Your API key
Your API token — keep this private
ボディ
Create a resend by warehouse-scoped SKU quantities. companyName is not part of this request.
Warehouse to fulfil the resend from. Must be greater than 0 and owned by the authenticated account. All selected inventory comes from this single warehouse.
Shipment service type code (not a return service type). Non-others values are validated against the available shipment service and service zone for the warehouse and destination.
Non-empty list of SKU + quantity lines. The number of raw lines is limited to 100; the combined quantity across all lines is limited to 100.
Destination address for the resend shipment.
Optional seller reference number. When provided, 1-50 characters with no invisible characters. Stored on the created resend shipment and echoed back in the response.
50Optional free-text description for the resend order.
Optional free-text merchant remarks for the resend order.
Optional free-text remarks addressed to the warehouse.
レスポンス
Success
Wraps CreateResendBySkuReply under data, alongside the standard correlationId and meta envelope.
Create resend by SKU result.