curl --request POST \
--url https://api.returnshelper.com/uat/user/api/Resend/createResendBySku \
--header 'Content-Type: application/json' \
--header 'x-rr-apikey: <api-key>' \
--header 'x-rr-apitoken: <api-key>' \
--data '
{
"warehouseId": 123,
"shipmentServiceType": "<string>",
"itemList": [
{
"sku": "<string>",
"quantity": 123
}
],
"toAddress": {
"contactName": "<string>",
"street1": "<string>",
"street2": "<string>",
"city": "<string>",
"state": "<string>",
"postalCode": "<string>",
"country": "<string>",
"phone": "<string>",
"addressType": "<string>",
"street3": "<string>",
"fax": "<string>",
"email": "<string>"
},
"sellerReferenceNumber": "<string>",
"description": "<string>",
"remarks": "<string>",
"warehouseRemarks": "<string>"
}
'import requests
url = "https://api.returnshelper.com/uat/user/api/Resend/createResendBySku"
payload = {
"warehouseId": 123,
"shipmentServiceType": "<string>",
"itemList": [
{
"sku": "<string>",
"quantity": 123
}
],
"toAddress": {
"contactName": "<string>",
"street1": "<string>",
"street2": "<string>",
"city": "<string>",
"state": "<string>",
"postalCode": "<string>",
"country": "<string>",
"phone": "<string>",
"addressType": "<string>",
"street3": "<string>",
"fax": "<string>",
"email": "<string>"
},
"sellerReferenceNumber": "<string>",
"description": "<string>",
"remarks": "<string>",
"warehouseRemarks": "<string>"
}
headers = {
"x-rr-apikey": "<api-key>",
"x-rr-apitoken": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-rr-apikey': '<api-key>',
'x-rr-apitoken': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
warehouseId: 123,
shipmentServiceType: '<string>',
itemList: [{sku: '<string>', quantity: 123}],
toAddress: {
contactName: '<string>',
street1: '<string>',
street2: '<string>',
city: '<string>',
state: '<string>',
postalCode: '<string>',
country: '<string>',
phone: '<string>',
addressType: '<string>',
street3: '<string>',
fax: '<string>',
email: '<string>'
},
sellerReferenceNumber: '<string>',
description: '<string>',
remarks: '<string>',
warehouseRemarks: '<string>'
})
};
fetch('https://api.returnshelper.com/uat/user/api/Resend/createResendBySku', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.returnshelper.com/uat/user/api/Resend/createResendBySku",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'warehouseId' => 123,
'shipmentServiceType' => '<string>',
'itemList' => [
[
'sku' => '<string>',
'quantity' => 123
]
],
'toAddress' => [
'contactName' => '<string>',
'street1' => '<string>',
'street2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'postalCode' => '<string>',
'country' => '<string>',
'phone' => '<string>',
'addressType' => '<string>',
'street3' => '<string>',
'fax' => '<string>',
'email' => '<string>'
],
'sellerReferenceNumber' => '<string>',
'description' => '<string>',
'remarks' => '<string>',
'warehouseRemarks' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-rr-apikey: <api-key>",
"x-rr-apitoken: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.returnshelper.com/uat/user/api/Resend/createResendBySku"
payload := strings.NewReader("{\n \"warehouseId\": 123,\n \"shipmentServiceType\": \"<string>\",\n \"itemList\": [\n {\n \"sku\": \"<string>\",\n \"quantity\": 123\n }\n ],\n \"toAddress\": {\n \"contactName\": \"<string>\",\n \"street1\": \"<string>\",\n \"street2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"addressType\": \"<string>\",\n \"street3\": \"<string>\",\n \"fax\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"sellerReferenceNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"remarks\": \"<string>\",\n \"warehouseRemarks\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-rr-apikey", "<api-key>")
req.Header.Add("x-rr-apitoken", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.returnshelper.com/uat/user/api/Resend/createResendBySku")
.header("x-rr-apikey", "<api-key>")
.header("x-rr-apitoken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"warehouseId\": 123,\n \"shipmentServiceType\": \"<string>\",\n \"itemList\": [\n {\n \"sku\": \"<string>\",\n \"quantity\": 123\n }\n ],\n \"toAddress\": {\n \"contactName\": \"<string>\",\n \"street1\": \"<string>\",\n \"street2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"addressType\": \"<string>\",\n \"street3\": \"<string>\",\n \"fax\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"sellerReferenceNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"remarks\": \"<string>\",\n \"warehouseRemarks\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.returnshelper.com/uat/user/api/Resend/createResendBySku")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-rr-apikey"] = '<api-key>'
request["x-rr-apitoken"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"warehouseId\": 123,\n \"shipmentServiceType\": \"<string>\",\n \"itemList\": [\n {\n \"sku\": \"<string>\",\n \"quantity\": 123\n }\n ],\n \"toAddress\": {\n \"contactName\": \"<string>\",\n \"street1\": \"<string>\",\n \"street2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"addressType\": \"<string>\",\n \"street3\": \"<string>\",\n \"fax\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"sellerReferenceNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"remarks\": \"<string>\",\n \"warehouseRemarks\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"resendId": 123,
"resendNumber": "<string>",
"resendShipmentId": 123,
"sellerReferenceNumber": "<string>",
"selectedReturnInventoryList": [
{
"returnInventoryId": 123,
"rmaCode": "<string>",
"sku": "<string>"
}
]
}
}{
"correlationId": "<string>",
"meta": {
"status": 123,
"data": {},
"errorCode": "<string>",
"error": {}
}
}以 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.
curl --request POST \
--url https://api.returnshelper.com/uat/user/api/Resend/createResendBySku \
--header 'Content-Type: application/json' \
--header 'x-rr-apikey: <api-key>' \
--header 'x-rr-apitoken: <api-key>' \
--data '
{
"warehouseId": 123,
"shipmentServiceType": "<string>",
"itemList": [
{
"sku": "<string>",
"quantity": 123
}
],
"toAddress": {
"contactName": "<string>",
"street1": "<string>",
"street2": "<string>",
"city": "<string>",
"state": "<string>",
"postalCode": "<string>",
"country": "<string>",
"phone": "<string>",
"addressType": "<string>",
"street3": "<string>",
"fax": "<string>",
"email": "<string>"
},
"sellerReferenceNumber": "<string>",
"description": "<string>",
"remarks": "<string>",
"warehouseRemarks": "<string>"
}
'import requests
url = "https://api.returnshelper.com/uat/user/api/Resend/createResendBySku"
payload = {
"warehouseId": 123,
"shipmentServiceType": "<string>",
"itemList": [
{
"sku": "<string>",
"quantity": 123
}
],
"toAddress": {
"contactName": "<string>",
"street1": "<string>",
"street2": "<string>",
"city": "<string>",
"state": "<string>",
"postalCode": "<string>",
"country": "<string>",
"phone": "<string>",
"addressType": "<string>",
"street3": "<string>",
"fax": "<string>",
"email": "<string>"
},
"sellerReferenceNumber": "<string>",
"description": "<string>",
"remarks": "<string>",
"warehouseRemarks": "<string>"
}
headers = {
"x-rr-apikey": "<api-key>",
"x-rr-apitoken": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-rr-apikey': '<api-key>',
'x-rr-apitoken': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
warehouseId: 123,
shipmentServiceType: '<string>',
itemList: [{sku: '<string>', quantity: 123}],
toAddress: {
contactName: '<string>',
street1: '<string>',
street2: '<string>',
city: '<string>',
state: '<string>',
postalCode: '<string>',
country: '<string>',
phone: '<string>',
addressType: '<string>',
street3: '<string>',
fax: '<string>',
email: '<string>'
},
sellerReferenceNumber: '<string>',
description: '<string>',
remarks: '<string>',
warehouseRemarks: '<string>'
})
};
fetch('https://api.returnshelper.com/uat/user/api/Resend/createResendBySku', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.returnshelper.com/uat/user/api/Resend/createResendBySku",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'warehouseId' => 123,
'shipmentServiceType' => '<string>',
'itemList' => [
[
'sku' => '<string>',
'quantity' => 123
]
],
'toAddress' => [
'contactName' => '<string>',
'street1' => '<string>',
'street2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'postalCode' => '<string>',
'country' => '<string>',
'phone' => '<string>',
'addressType' => '<string>',
'street3' => '<string>',
'fax' => '<string>',
'email' => '<string>'
],
'sellerReferenceNumber' => '<string>',
'description' => '<string>',
'remarks' => '<string>',
'warehouseRemarks' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-rr-apikey: <api-key>",
"x-rr-apitoken: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.returnshelper.com/uat/user/api/Resend/createResendBySku"
payload := strings.NewReader("{\n \"warehouseId\": 123,\n \"shipmentServiceType\": \"<string>\",\n \"itemList\": [\n {\n \"sku\": \"<string>\",\n \"quantity\": 123\n }\n ],\n \"toAddress\": {\n \"contactName\": \"<string>\",\n \"street1\": \"<string>\",\n \"street2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"addressType\": \"<string>\",\n \"street3\": \"<string>\",\n \"fax\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"sellerReferenceNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"remarks\": \"<string>\",\n \"warehouseRemarks\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-rr-apikey", "<api-key>")
req.Header.Add("x-rr-apitoken", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.returnshelper.com/uat/user/api/Resend/createResendBySku")
.header("x-rr-apikey", "<api-key>")
.header("x-rr-apitoken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"warehouseId\": 123,\n \"shipmentServiceType\": \"<string>\",\n \"itemList\": [\n {\n \"sku\": \"<string>\",\n \"quantity\": 123\n }\n ],\n \"toAddress\": {\n \"contactName\": \"<string>\",\n \"street1\": \"<string>\",\n \"street2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"addressType\": \"<string>\",\n \"street3\": \"<string>\",\n \"fax\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"sellerReferenceNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"remarks\": \"<string>\",\n \"warehouseRemarks\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.returnshelper.com/uat/user/api/Resend/createResendBySku")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-rr-apikey"] = '<api-key>'
request["x-rr-apitoken"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"warehouseId\": 123,\n \"shipmentServiceType\": \"<string>\",\n \"itemList\": [\n {\n \"sku\": \"<string>\",\n \"quantity\": 123\n }\n ],\n \"toAddress\": {\n \"contactName\": \"<string>\",\n \"street1\": \"<string>\",\n \"street2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCode\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"addressType\": \"<string>\",\n \"street3\": \"<string>\",\n \"fax\": \"<string>\",\n \"email\": \"<string>\"\n },\n \"sellerReferenceNumber\": \"<string>\",\n \"description\": \"<string>\",\n \"remarks\": \"<string>\",\n \"warehouseRemarks\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"resendId": 123,
"resendNumber": "<string>",
"resendShipmentId": 123,
"sellerReferenceNumber": "<string>",
"selectedReturnInventoryList": [
{
"returnInventoryId": 123,
"rmaCode": "<string>",
"sku": "<string>"
}
]
}
}{
"correlationId": "<string>",
"meta": {
"status": 123,
"data": {},
"errorCode": "<string>",
"error": {}
}
}何時使用本端點,而非 Create resend order
- 當您以 SKU 與數量追蹤庫存、且不想管理個別
returnInventoryId值時,使用以 SKU 建立 Resend。 - 當您已握有想補寄的特定
returnInventoryId值(例如從newInventoryCreatedwebhook 快取而來)時,使用 Create resend order。
前置條件
- 您的帳戶已啟用 SKU 庫存模組(Enterprise)。
- 該倉庫中每個請求的 SKU 都有足夠、符合補寄資格的庫存。請先以 搜尋 SKU 庫存(
availableQuantity)確認彙總量,但請注意通過彙總檢查並非保證——見下文。 shipmentServiceType是 Shipment Service Type(不是 Return Service Type)。有效代碼請見 取得 Warehouse 可用的 Shipment Service Types。
挑選機制
配置分三個階段,且只有最後一個階段具權威性:- 驗證。 您的請求行會被正規化(SKU trim + 轉大寫),重複的 SKU 會被合併。驗證會依
warehouseId+ 正規化後 SKU 檢查availableQuantity。通過此檢查僅代表彙總量看起來足夠——不會保留或配置任何東西。 - 挑選。 系統查詢符合您
warehouseId與正規化 SKU 且具補寄資格的實際退件庫存記錄,再依挑貨策略恰好挑出所請求的數量。若符合資格的記錄少於請求量,整筆請求會被拒絕。 - 配置。 在交易內,將被挑選的列加鎖並重新檢查;若有任何一列不再符合資格,交易回滾且請求失敗。否則所有被挑選的記錄會被推進至 resend / in-progress,並在同一交易內建立補寄。
SkuInventory.availableQuantity 是提前檢查,並非保留。 多個並行請求可能同時通過相同的彙總檢查;只有成功鎖定並取得底層記錄的請求才會提交(commit)。其餘請求會以驗證錯誤失敗,並可重試。加鎖的配置始終是最終權威。資格規則
退件庫存記錄唯有在符合以下條件時才可被挑選:- 符合請求的
warehouseId與正規化後 SKU; handlingStatusCode= pending;- 可轉換至 resend / in-progress;且
- 無待處理 VAS,包含任何未完成的 VAS Split。
availableQuantity(後者仍可能計入帶待處理 VAS 的記錄)。當發生此情況時,請求會以 fail-closed 方式失敗,而非補寄不符資格的項目。
挑貨策略
挑選預設採 LIFO:最新的合資格退件庫存優先,並以最大的退件庫存 ID 作為決勝依據。此策略置於工廠(factory)之後,未來可切換為 FIFO 而不需更動配置邏輯。錯誤與重試
- 驗證失敗會以 HTTP 200 搭配
meta.status: 400回傳(標準的軟錯誤封套——見錯誤處理)。 - 當某個 SKU 可用量不足時,會整筆拒絕請求。基於安全考量,錯誤不會揭露剩餘可用量。
- 當並行請求爭用相同庫存時,未能鎖定記錄的請求會被拒絕,並可重試。
等冪性
x-returnhelper-idempotency-key 標頭為選填。未帶此標頭的呼叫會正常執行,但不具備防重複的保護。請參閱等冪性。
相關
- 搜尋 SKU 庫存 — 在請求前確認
availableQuantity。 - Create resend order — 以明確的退件庫存 ID 補寄;亦涵蓋面單產生(自動 vs 手動服務類型)與取消截止時間,這些同樣適用於此處建立的補寄。
- 取消補寄訂單 — 在倉庫出貨前中止。
- 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.
Show child attributes
Show child attributes
Destination address for the resend shipment.
Show child attributes
Show child attributes
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.
Show child attributes
Show child attributes