> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.returnhelper.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 返品ラベルをキャンセル

> [!WARNING]
>
> このページはAIによって自動翻訳されています。API技術仕様は英語が正式です。不明点がある場合は[英語版](/api-reference/returnshipment/cancel-return-label)を参照してください。

[Return Shipment を作成](/ja/api-reference/returnshipment/create-return-shipment)で作成した返品ラベルをキャンセルします。作成時のレスポンス、または [`labelGenerated`](/ja/webhooks#label-result) webhook で受け取った `labelId` を指定してください。

## ラベルをキャンセルできる条件

以下の条件をすべて満たす必要があります。いずれかを満たさない場合、バリデーションのソフトエラー（HTTP 200、`meta.status: 400`、`meta.errorCode: VALIDATION_FAILED`）が返され、メッセージは `meta.error.labelId` に入ります。[エラーコード](/ja/reference/error-codes)を参照してください。

| 条件 | 満たさない場合の `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 の詳細を取得](/ja/api-reference/returnshipment/get-return-request)でも返されます。

## キャンセル成功後

[Return Shipment の詳細を取得](/ja/api-reference/returnshipment/get-return-request)は次の値を返します：

| フィールド | 値 |
| - | - |
| `returnStatusCode` | `label-canceled` |
| `shipments[].shipmentStatusCode` | `lb-canceled` |
| `shipments[].labelId` | `0` |
| `shipments[].label` | `null` |

キャンセルしたラベルは返されなくなります。後で必要になる場合は、その `labelId` を自社側で保持してください。

## シップメントの修正

キャンセルされた返品リクエストに新しいラベルを発行することはできません。シップメントを修正するには、ラベルをキャンセルしてから、修正した内容で [Return Shipment を作成](/ja/api-reference/returnshipment/create-return-shipment)を再度呼び出してください。新しい呼び出しでは新しい `returnRequestId`、`shipmentId`、`labelId` が返されます。キャンセルした返品リクエストは `label-canceled` のままです。

## 冪等性

`x-returnhelper-idempotency-key` ヘッダーは任意です。付与しない呼び出しも通常どおり実行されますが、重複に対する保護はありません。[冪等性](/ja/introduction#idempotency)を参照してください。

## 関連

* [Return Shipment を作成](/ja/api-reference/returnshipment/create-return-shipment) — 差し替え用のシップメントを作成。
* [Return Shipment の詳細を取得](/ja/api-reference/returnshipment/get-return-request) — `cancelCutoffTime` と現在のステータスを確認。
* [Webhooks](/ja/webhooks#label-result) — `labelGenerated` には `labelId` と `cancelCutoffTime` が含まれます。


## OpenAPI

````yaml post /api/Label/CancelLabel
openapi: 3.1.0
info:
  title: Return Helper API
  description: API documentation for Return Helper — covering User and Public endpoints.
  version: 1.0.0
servers:
  - url: https://api.returnshelper.com/uat/user
    description: Sandbox — User API
  - url: https://api.returnshelper.com/uat/public
    description: Sandbox — Public API
  - url: https://api.returnhelpercentre.com/v1/user
    description: Production — User API
  - url: https://api.returnhelpercentre.com/v1/public
    description: Production — Public API
  - url: https://api.returnhelperchina.com/user
    description: Production — User API (China)
security:
  - ApiKey: []
    ApiToken: []
paths:
  /api/Label/CancelLabel:
    post:
      tags:
        - ReturnShipment
      summary: Cancel return label
      operationId: ReturnUserApi_CancelLabel
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelLabelRequest'
      responses:
        '200':
          description: >-
            Success — returns the standard response envelope with no additional
            payload fields. Inspect meta.status to confirm the label was
            cancelled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
        '401':
          description: >-
            Authentication failed. Returned when the `x-rr-apikey` or
            `x-rr-apitoken` header is missing or invalid. The body uses the
            standard `ApiResponse` envelope with `meta.error.message` describing
            the auth failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
      security:
        - ApiKey: []
          ApiToken: []
      servers:
        - url: https://api.returnshelper.com/uat/user
          description: Sandbox — User API
components:
  schemas:
    CancelLabelRequest:
      type: object
      properties:
        labelId:
          type: integer
          format: int64
          description: >-
            ID of the label to cancel, as returned by Create return shipment and
            the `labelGenerated` webhook
      required:
        - labelId
    ApiResponse:
      type: object
      description: >-
        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.
      properties:
        correlationId:
          type:
            - string
            - 'null'
          description: >-
            Unique correlation ID for tracing the request through Return Helper
            systems.
        meta:
          $ref: '#/components/schemas/ApiResponseMeta'
    ApiResponseMeta:
      type: object
      description: >-
        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`).
      properties:
        status:
          type: integer
          description: >-
            Application-level status code. For successful operations this
            mirrors the HTTP status (e.g. 200). For validation failures it
            reports the logical status (e.g. 400) even though the wire HTTP
            status is 200.
        data:
          type: object
          additionalProperties:
            type: string
          description: Reserved free-form metadata key/value pairs. Usually empty.
        errorCode:
          type:
            - string
            - 'null'
          description: >-
            Machine-readable error code (e.g. `VALIDATION_FAILED`). Non-null
            only when the operation failed.
        error:
          type: object
          additionalProperties: true
          description: >-
            Field-level or message-level error detail keyed by request property
            name. Empty object on success.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-rr-apikey
      description: Your API key
    ApiToken:
      type: apiKey
      in: header
      name: x-rr-apitoken
      description: Your API token — keep this private

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.