> ## 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.

# 更新 Return Inventory Handling

<Warning>
  此頁面由 AI 自動翻譯。API 技術規格以英文呈現為標準。如有任何疑問，請參閱[英文版本](/api-reference/returninventory/update-return-inventory-handling)。
</Warning>

更新單筆退件庫存紀錄的處理決定——告訴倉庫該如何處置已收到的包裹。多於倉庫登記包裹後呼叫；自此庫存便會沿著所選處理路徑（入庫、銷毀、召回、補寄等）繼續。

## 何時呼叫

* 客服或營運團隊決定處理方式後。

## 必填欄位

* **`returnInventoryId`** — 長整數；必須存在且屬於您的帳戶。倉庫登記包裹時由 `newInventoryCreated` webhook 事件推送；請在自有端快取以備後續操作。webhook 流為庫存 ID 的真實資料來源。
* **`handlingCode`** — 字串，必須是 [取得所有處理類型](/zh-Hant/api-reference/handling/get-all-handling-types) 回傳的值之一。**不能**直接使用 `rsd`（補寄）或 `tbc`（待確認）——這兩類有專屬端點。常用值：`ohd`（暫存）、`rtn`（退回）、`rst`（入庫）、`dsp`（銷毀）。

特殊例外：若目前 `handlingStatusCode` 為 `pending` 且新處理為 `ohd`（暫存），呼叫始終允許——便於在調查期間將庫存掛起。

下列情況**無法**更新處理：

* 庫存所屬行項目存在待處理的 VAS（加值服務）請求。請先透過 [取得所有 VAS](/zh-Hant/api-reference/vas/get-all-value-added-services) 與 VAS 端點取消或完成 VAS。

## 副作用

* 庫存紀錄上的 `handlingCode` 與 `handlingStatusCode` 會被更新。
* 若新處理**不是** `ohd` 或 `oth`（其他），將鎖定 RMA 對映以禁止對該庫存進行 RMA 交換。

## 相關

* [取消退件庫存處理](/zh-Hant/api-reference/returninventory/cancel-return-inventory-handling) — 在倉庫執行前撤銷處理決定。
* [依退件庫存 ID 建立召回](/zh-Hant/api-reference/recall/create-recall-by-return-inventory-ids) — 透過專屬召回流程處理被召回的庫存。
* [建立補寄訂單](/zh-Hant/api-reference/resend/create-resend-order) — 走補寄路徑（同樣無法直接透過本端點抵達）。
* [Webhooks](/zh-Hant/webhooks) — `newInventoryCreated`、`vasUpdated`、庫存處理完成事件與 `notifyUserRmaSwapped` 都會推送庫存生命週期至您的端點。


## OpenAPI

````yaml post /api/ReturnInventory/UpdateReturnInventoryHandling
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/ReturnInventory/UpdateReturnInventoryHandling:
    post:
      tags:
        - ReturnInventory
      summary: Update return inventory handling
      operationId: ReturnUserApi_UpdateReturnInventoryHandling
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateReturnInventoryHandlingRequest'
      responses:
        '200':
          description: Success
          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:
    UpdateReturnInventoryHandlingRequest:
      type: object
      properties:
        returnInventoryId:
          type: integer
          format: int64
          description: Return inventory ID to update handling for
        handlingCode:
          type: string
          description: Handling code to apply
      required:
        - returnInventoryId
        - handlingCode
    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

````