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