Skip to content

Variant API

Request an inventory edit request for a product variation (with webhook notification)

Properties for inventory information

Item name Description
reference_number (Required) Control number
"56bca058-c171-4e58-a3a1-8c653de898aa"
You can set the control number separately from the product ID that is automatically assigned by BUYMA.
You cannot use the same control number.
However, if id is entered, it will be given priority in searching for products, so it is not necessary to enter it.
id
Product ID
1000000000
This is the product ID issued by BUYMA.
variants Sales Availability/Stock
[
    {
        "options": [
            { "type": "size", "value": "S" },
            { "type": "color", "value": "White" }
        ],
        "stock_type": "stock_in_hand",
        "stocks": 1
    },
    {
        "options": [
            { "type": "size", "value": "M" },
            { "type": "color", "value": "White" }
        ],
        "stocks": 2
    },
    {
        "options": [
            { "type": "size", "value": "M" },
            { "type": "color", "value": "Black" }
        ],
        "stock_type": "out_of_stock"
    }
]
An array specifying product variations and availability.
Only describe variations that need to be changed.
No new variations can be registered.
Item name Description
options (Required) Product variation
Example: To specify a variation with color Black and size M
[
  { "type": "color", "value": "Black" },
  { "type": "size", "value": "M" }
]
https://qa.buyma.com/shopper/sell/5821.html
stock_type Type of stock control
(No need to include if there are no changes)
  • stock_in_hand: Stock in hand
  • purchase_for_order: Available for purchase
  • out_of_stock: Out of stock
https://qa.buyma.com/shopper/sell/11325.html
stocks Number of Stocks
(Only if registering with stock_in_hand)
order_quantity Total quantity that can be purchased.
10
This is the quantity that can be purchased, not including the quantity in stock on hand.
Can only be specified if variants include purchase_for_order

Important

You need to enter either order_quantity or variants.

Important: About listing status

If the item is out of stock and will be sold out, the listing will be stopped. If more stock is added and the item will be restocked, the status will be "Listed".


POST /api/v1/products/variants.json (single product)

Accepts a request to edit the number of items in stock for a particular variation of a product. Only a simple validation of required fields will be performed at request execution time.

API request

To change the number of variations

POST /api/v1/products/variants.json
{
  "product": {
    "reference_number": "ABC0001",
    "variants": [
      {
        "options": [
          { "type": "size", "value": "S" },
          { "type": "color", "value": "White" }
        ],
        "stock_type": "stock_in_hand",
        "stocks": 10
      },
      {
        "options": [
          { "type": "size", "value": "S" },
          { "type": "color", "value": "Black" }
        ],
        "stocks": 10
      },
      {
        "options": [
          { "type": "size", "value": "M" },
          { "type": "color", "value": "Black" }
        ],
        "stock_type": "out_of_stock"
      }
    ]
  }
}

To change only the total quantity that can be purchased

POST /api/v1/products/variants.json
{
  "product": {
    "reference_number": "ABC0001",
    "order_quantity": 100
  }
}

API Response

Success

HTTP/1.1 201 Created
{
  "request_received_at": "2019-09-05T12:10:40.114775+09:00",
  "request_uid": "2001909051121040114775174828"
}

Item

Description

request_received_at

Request received date and time (ISO8601)

request_uid

request identifier

failure

HTTP/1.1 422 Unprocessable Entity
{
  "errors": {
    "variants": {
      "0": {
        "stocks": [
          "The number of stocks must be entered."
        ]
      }
    }
  }
}

This will perform simple validation of required fields, etc.

Item

Description

errors

Error for each input item

POST /api/v1/products/variants.json (multiple products)

You can specify up to 300 different inventories of multiple products in an array.

API Request

POST /api/v1/products/variants.json
{
  "products": [
    {
      "reference_number": "ABC0001",
      "variants": [
        {
          "options": [
            { "type": "size", "value": "S" }
            { "type": "color", "value": "White" }
          ],
          "stocks": 10
        },
        {
          "options": [
            { "type": "size", "value": "M" },
            { "type": "color", "value": "White" }
          ],
          "stocks": 5
        }
      ]
    },
    {
      "reference_number": "ABC0002",
      "variants": [
        {
          "options": [
            { "type": "size", "value": "M" },
            { "type": "color", "value": "Black" }
          ],
          "stocks": 20
        }
      ]
    }
  ]
}

API Response

Success

Batch request identifier returned.

HTTP/1.1 201 Created
{
  "request_uid": "202011091162148098276938457",
  "request_received_at": "2020-11-09T16:21:48.098276+09:00",
  "batch_size": 300
}

Item

Description

request_uid

request identifier

request_received_at

Request received date and time (ISO8601)

batch_size

number of items

Important: About Batch Requests

Each product in the batch will be issued an individual request ID and notified in the webhook event (product/bulk_variants_update_requested) about the request. If a validation error occurs, it will be notified in a separate webhook event (product/fail_to_update).

failure

The result of validation is returned for each array index.

HTTP/1.1 422 Unprocessable Entity
{
  "products": {
    "0": {
      "errors": {
        "variants": {
          "0": {
            "stocks": [
              "The number of stocks must be entered."
            ]
          }
        }
      }
    },
    "1": {
      "errors": {
        "variants": {
          "0": {
            "stocks": [
              "The number of stocks must be entered."
            ]
          }
        }
      }
    }
  }
}

This will perform simple validation of required fields, etc.

Item

Description

errors

Error for each input item