curl --request POST \
--url https://api.returnshelper.com/uat/user/api/Label/CancelLabel \
--header 'Content-Type: application/json' \
--header 'x-rr-apikey: <api-key>' \
--header 'x-rr-apitoken: <api-key>' \
--data '{
"labelId": 123
}'import requests
url = "https://api.returnshelper.com/uat/user/api/Label/CancelLabel"
payload = { "labelId": 123 }
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({labelId: 123})
};
fetch('https://api.returnshelper.com/uat/user/api/Label/CancelLabel', 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/Label/CancelLabel",
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([
'labelId' => 123
]),
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/Label/CancelLabel"
payload := strings.NewReader("{\n \"labelId\": 123\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/Label/CancelLabel")
.header("x-rr-apikey", "<api-key>")
.header("x-rr-apitoken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"labelId\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.returnshelper.com/uat/user/api/Label/CancelLabel")
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 \"labelId\": 123\n}"
response = http.request(request)
puts response.read_body{
"correlationId": "<string>",
"meta": {
"status": 123,
"data": {},
"errorCode": "<string>",
"error": {}
}
}{
"correlationId": "<string>",
"meta": {
"status": 123,
"data": {},
"errorCode": "<string>",
"error": {}
}
}返品ラベルをキャンセル
curl --request POST \
--url https://api.returnshelper.com/uat/user/api/Label/CancelLabel \
--header 'Content-Type: application/json' \
--header 'x-rr-apikey: <api-key>' \
--header 'x-rr-apitoken: <api-key>' \
--data '{
"labelId": 123
}'import requests
url = "https://api.returnshelper.com/uat/user/api/Label/CancelLabel"
payload = { "labelId": 123 }
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({labelId: 123})
};
fetch('https://api.returnshelper.com/uat/user/api/Label/CancelLabel', 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/Label/CancelLabel",
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([
'labelId' => 123
]),
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/Label/CancelLabel"
payload := strings.NewReader("{\n \"labelId\": 123\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/Label/CancelLabel")
.header("x-rr-apikey", "<api-key>")
.header("x-rr-apitoken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"labelId\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.returnshelper.com/uat/user/api/Label/CancelLabel")
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 \"labelId\": 123\n}"
response = http.request(request)
puts response.read_body{
"correlationId": "<string>",
"meta": {
"status": 123,
"data": {},
"errorCode": "<string>",
"error": {}
}
}{
"correlationId": "<string>",
"meta": {
"status": 123,
"data": {},
"errorCode": "<string>",
"error": {}
}
}labelGenerated webhook で受け取った labelId を指定してください。
ラベルをキャンセルできる条件
以下の条件をすべて満たす必要があります。いずれかを満たさない場合、バリデーションのソフトエラー(HTTP 200、meta.status: 400、meta.errorCode: VALIDATION_FAILED)が返され、メッセージは meta.error.labelId に入ります。エラーコードを参照してください。
| 条件 | 満たさない場合の meta.error.labelId |
|---|---|
| ラベルが自分のアカウントに属している | Label:{labelId} not found |
ラベルが生成済み(labelRequestStatusCode が success) | Cancel label only when label status is success |
現在時刻がラベルの cancelCutoffTime より前 | The cancellation cutoff Time {cancelCutoffTime} has already passed. |
| 倉庫がまだパーセルを受け取っていない | Cancel label only when shipment status is lb-printed |
cancelCutoffTime は labelGenerated webhook でラベルと一緒に配信され、Return Shipment の詳細を取得でも返されます。
キャンセル成功後
Return Shipment の詳細を取得は次の値を返します:| フィールド | 値 |
|---|---|
returnStatusCode | label-canceled |
shipments[].shipmentStatusCode | lb-canceled |
shipments[].labelId | 0 |
shipments[].label | null |
labelId を自社側で保持してください。
シップメントの修正
キャンセルされた返品リクエストに新しいラベルを発行することはできません。シップメントを修正するには、ラベルをキャンセルしてから、修正した内容で Return Shipment を作成を再度呼び出してください。新しい呼び出しでは新しいreturnRequestId、shipmentId、labelId が返されます。キャンセルした返品リクエストは label-canceled のままです。
冪等性
x-returnhelper-idempotency-key ヘッダーは任意です。付与しない呼び出しも通常どおり実行されますが、重複に対する保護はありません。冪等性を参照してください。
関連
- Return Shipment を作成 — 差し替え用のシップメントを作成。
- Return Shipment の詳細を取得 —
cancelCutoffTimeと現在のステータスを確認。 - Webhooks —
labelGeneratedにはlabelIdとcancelCutoffTimeが含まれます。
承認
Your API key
Your API token — keep this private
ボディ
ID of the label to cancel, as returned by Create return shipment and the labelGenerated webhook
レスポンス
Success — returns the standard response envelope with no additional payload fields. Inspect meta.status to confirm the label was cancelled.
Universal response envelope. Successful responses include the business payload as additional top-level fields alongside correlationId and meta. Failed responses (auth errors, validation errors) only populate correlationId and meta, with meta.errorCode and meta.error describing the failure.
Unique correlation ID for tracing the request through Return Helper systems.
Application-level metadata for every API response. Inspect status and errorCode to detect soft-error responses (validation failures arrive as HTTP 200 with meta.status: 400).
Show child attributes
Show child attributes