> ## 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 ID で VAS を作成

> Create value-added service requests for one or more return inventories. Inventory must be set to On-hold handling before creating VAS. Split parcel VAS must be submitted separately from other VAS types.

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

受領済みの返品在庫に対して 1 件以上の付加価値サービス（VAS）——品質検査、再梱包、撮影、パーセル分割など——をリクエストします。倉庫が VAS を実行し、結果は後続の webhook イベントで報告されます。

## 前提条件

* 対象在庫アイテムがアカウントに存在していること。`returnInventoryId` は `newInventoryCreated` webhook イベントで配信されるため、自社側でキャッシュしてください。
* 各対象在庫の `handlingCode` が `ohd`（保留）であること。VAS は在庫が保留状態のときのみ許可されます。すでに別のハンドリング経路に入っている場合は、まず [返品在庫ハンドリングを更新](/ja/api-reference/returninventory/update-return-inventory-handling) で `ohd` に戻してください。
* 有効な `vasCode` 値は [すべての VAS を取得](/ja/api-reference/vas/get-all-value-added-services) から選んでください。

## 必須フィールド

* **`createVasList`** — 空でないペイロードのリスト。各ペイロードが 1 件の在庫と、その上の 1 件以上の VAS リクエストをカバーします。

ペイロードごと：

* **`returnInventoryId`** — long にパース可能な文字列。存在し、保留状態であること。
* **`createVasDetailList`** — VAS 詳細オブジェクトのリスト。各項目は `vasCode` とその VAS 固有のフィールドを保持します。

`returnInventoryId` はバッチ全体でユニークである必要があります——同一呼び出しで同じ在庫に 2 つのペイロードを作ることはできません。

## 分割パーセル ルール

ペイロード内のいずれかの VAS が `vasCode: SPLIT_PARCEL` を使う場合：

* そのペイロードの `createVasDetailList` における **唯一の** VAS でなければなりません（同じ在庫の 1 つのペイロード内で他の VAS と組み合わせることはできません）。
* ファイル添付は `SPLIT_PARCEL` のみで許可され（通常必須）、他の VAS コードでは添付できません。

このルールが課されているのは、分割が物理在庫の形態を変えるためで、他の VAS と同梱すると処理順序が曖昧になります。

## 副作用

* VAS が保留中の間、在庫のハンドリングは `ohd` のままです。
* 後続の webhook イベントが進捗を報告します：`vasUpdated`、そして分割パーセルの場合は `splitLineItem` および `newInventoryCreated`（分割アイテム用）。
* 分割パーセル VAS の完了により、追加の在庫レコード（分割後のアイテム）が生成される場合があります。

## 関連

* [すべての VAS を取得](/ja/api-reference/vas/get-all-value-added-services) — 有効な `vasCode` 値。
* [すべての VAS ステータスを取得](/ja/api-reference/vasstatus/get-all-vas-statuses) — VAS ライフサイクルのコード → ラベル マッピング。
* [返品在庫ハンドリングを更新](/ja/api-reference/returninventory/update-return-inventory-handling) — 在庫が `ohd` から外れた場合に戻す。
* [Webhooks](/ja/webhooks) — `vasUpdated` イベントが VAS ライフサイクルの進捗をエンドポイントへ報告します。


## OpenAPI

````yaml post /api/Vas/CreateByReturnInventoryId
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/Vas/CreateByReturnInventoryId:
    post:
      tags:
        - Vas
      summary: Create VAS by return inventory ID
      description: >-
        Create value-added service requests for one or more return inventories.
        Inventory must be set to On-hold handling before creating VAS. Split
        parcel VAS must be submitted separately from other VAS types.
      operationId: ReturnUserApi_CreateVasByReturnInventoryId
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVasByReturnInventoryIdRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeneralList_CreateVasReply'
        '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:
    CreateVasByReturnInventoryIdRequest:
      type: object
      properties:
        createVasList:
          type: array
          items:
            $ref: '#/components/schemas/CreateVasByReturnInventoryIdPayload'
          description: List of VAS creation payloads grouped by return inventory ID
      required:
        - createVasList
    GeneralList_CreateVasReply:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/CreateVasReply'
          description: List of created VAS
    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'
    CreateVasByReturnInventoryIdPayload:
      type: object
      properties:
        returnInventoryId:
          type: string
          description: Return inventory ID to create VAS for
        createVasDetailList:
          type: array
          items:
            $ref: '#/components/schemas/CreateVasDetail'
          description: List of VAS details to create
      required:
        - returnInventoryId
        - createVasDetailList
    CreateVasReply:
      type: object
      properties:
        returnRequestLineItemId:
          type: integer
          format: int64
        createVasDetailList:
          type: array
          items:
            type: object
            description: '(see source: CreateVasDetailReply)'
    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.
    CreateVasDetail:
      type: object
      properties:
        vasCode:
          type: string
          description: >-
            VAS code to create (e.g. use Get All VAS to retrieve available
            codes)
        notes:
          type:
            - string
            - 'null'
          description: Additional notes for the VAS request
        metaQuantity:
          type: integer
          format: int32
          description: Quantity for the VAS operation (applicable for split parcel)
        vasFileList:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/CreateVasFilePayload'
          description: Files for the VAS request (applicable for split parcel only)
      required:
        - vasCode
    CreateVasFilePayload:
      type: object
      properties:
        filename:
          type: string
          description: Filename of the VAS file
        fileKey:
          type: string
          description: S3 file key of the uploaded file
      required:
        - filename
        - fileKey
  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

````