---
title: "创建商品款式"
description: "指定商品创建款式信息。"
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/product-variant/create-a-variant'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/product/product-variant/create-a-variant.md'
---
# 创建商品款式

指定商品创建款式信息。

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `write_products`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
POST /products/:product_id/variants.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。

## Required Permissions

* `write_products`

## Request

### Path Parameters

* `product_id`

  string (required)

  商品的唯一标识 ID。<br/>
  最大长度限制：64 

### Request Headers

* `Content-Type`

  string (required)

  字段值固定为 `application/json; charset=utf-8`。

* `Authorization`

  string (required)

  资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。

### Request Body

* `variant`

  object

  商品款式信息。

  * `weight_unit`

    string

    款式的重量单位。有效枚举值包含：
    - `g`：克
    - `kg`：千克
    - `lb`：磅
    - `oz`：盎司
    - `zh_kg`：公斤
    
    默认值: `g`

  * `inventory_tracker`

    boolean

    表明是否开启库存追踪。
    - `true`：开启库存追踪。
    - `false`：不开启库存追踪。
    
    默认值：`true`

  * `option4`

    string

    款式第四个规格的信息。<br/>
    最大长度限制：255

  * `option5`

    string

    款式第五个规格的信息。<br/>
    最大长度限制：255

  * `barcode`

    string

    款式的条形码。<br/>
    最大长度限制：255

  * `compare_at_price`

    string

    款式的原价，数值保留到小数点后两位。<br/>默认值: `0`

  * `inventory_policy`

    string

    表明款式是否允许超卖。
    - `deny`：不允许超卖。
    - `continue`：允许超卖。
    
    默认值: `deny`

  * `taxable`

    boolean

    表明款式是否需要收税。
    - `true`：需要收税。
    - `false`：不需要收税。
    
    默认值: `true`

  * `weight`

    string

    款式的重量，要求大于 0，超过两位小数向上取整。

  * `image`

    object

    款式的图片。

    * `alt`

      string

      款式图的替代文本描述，通常是具有图片特征或内容的单词或短语。<br/>
      最大长度限制：512

    * `id`

      string

      款式图的唯一标识 ID。<br/>
      最大长度限制：64 

    * `src`

      string

      款式图的链接，以 URL 形式展示。<br/>
      最大长度限制：255

  * `option1`

    string

    款式第一个规格的信息。<br/>
    最大长度限制：255

  * `option2`

    string

    款式第二个规格的信息。<br/>
    最大长度限制：255

  * `option3`

    string

    款式第三个规格的信息。<br/>
    最大长度限制：255

  * `price`

    string

    款式的售价，数值保留到小数点后两位。<br/>默认值：`0`

  * `required_shipping`

    boolean

    表明款式是否需要运输。
    - `true`：需要运输。
    - `false`：不需要运输。
    
    默认值：`true`

  * `sku`

    string

    商家为款式自定义的标识，区别于 SHOPLINE 生成的 `variant.id`。<br/>
    最大个数限制：255

## Response

### Status Codes

* `200`

  更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。

* `201`

  

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。

### Response Body

#### 200

* `variant`

  object

  商品款式信息。

  * `inventory_tracker`

    boolean

    表明是否开启库存追踪。
    - `true`：开启库存追踪。
    - `false`：不开启库存追踪。

  * `weight`

    string

    款式的重量，超过两位小数时向上取整。

  * `option1`

    string

    款式第一个规格的信息。

  * `option3`

    string

    款式第三个规格的信息。

  * `option5`

    string

    款式第五个规格的信息。

  * `taxable`

    boolean

    表明款式是否需要收税。
    - `true`：需要收税。
    - `false`：不需要收税。

  * `id`

    string

    款式的唯一标识 ID。

  * `inventory_item_id`

    string

    库存单位的唯一标识 ID。

  * `inventory_policy`

    string

    表明款式是否允许超卖。
    - `deny`：不允许超卖。
    - `continue`：允许超卖。

  * `option2`

    string

    款式第二个规格的信息。

  * `weight_unit`

    string

    款式的重量单位。有效枚举值包含：
    - `g`：克
    - `kg`：千克
    - `lb`：磅
    - `oz`：盎司
    - `zh_kg`：公斤

  * `created_at`

    string

    款式的创建时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。

  * `inventory_quantity`

    integer

    各存放地点的库存数量总和。

  * `option4`

    string

    款式第四个规格的信息。

  * `price`

    string

    款式的售价，数值保留到小数点后两位。
    

  * `product_id`

    string

    款式对应商品的唯一标识 ID。

  * `required_shipping`

    boolean

    表明款式是否需要运输。
    - `true`：需要运输。
    - `false`：不需要运输。

  * `sku`

    string

    商家为款式自定义的标识，区别于 SHOPLINE 生成的 `variant.id`。

  * `updated_at`

    string

    款式最近一次更新的时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。

  * `barcode`

    string

    款式的条形码。

  * `compare_at_price`

    string

    款式的原价，数值保留到小数点后两位。

  * `image`

    object

    款式的图片。

    * `alt`

      string

      款式图的替代文本描述，通常是具有图片特征或内容的单词或短语。

    * `id`

      string

      款式图的唯一标识 ID。

    * `src`

      string

      款式图的链接，以 URL 形式展示。


#### 201

* `errors`

  string

  错误描述。


#### 401

* `errors`

  string

  错误描述。


#### 429

* `errors`

  string

  错误描述。


## OpenAPI Definition

```json
{
  "tags": [
    "创建商品款式"
  ],
  "description": "指定商品创建款式信息。",
  "externalDocs": {
    "description": "接口使用的权限点: `write_products` ，更多权限点使用信息，请参考:",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=zh-hans-cn",
    "errorTableDescription": ""
  },
  "operationId": "zYmEnSCX",
  "parameters": [
    {
      "name": "product_id",
      "in": "path",
      "description": "商品的唯一标识 ID。<br/>\n最大长度限制：64 ",
      "required": true,
      "style": "simple",
      "schema": {
        "name": "product_id",
        "description": "商品的唯一标识 ID。<br/>\n最大长度限制：64 ",
        "type": "string",
        "example": "16057039432335097907370282"
      },
      "example": "16057039432335097907370282",
      "examples": {
        "创建商品款式": {
          "value": "16060895302856191591063144"
        }
      }
    },
    {
      "name": "Content-Type",
      "in": "header",
      "description": "字段值固定为 `application/json; charset=utf-8`。",
      "required": true,
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "name": "body",
          "description": "body位置参数",
          "type": "object",
          "properties": {
            "variant": {
              "name": "variant",
              "description": "商品款式信息。",
              "type": "object",
              "properties": {
                "weight_unit": {
                  "name": "weight_unit",
                  "description": "款式的重量单位。有效枚举值包含：\n- `g`：克\n- `kg`：千克\n- `lb`：磅\n- `oz`：盎司\n- `zh_kg`：公斤\n\n默认值: `g`",
                  "type": "string"
                },
                "inventory_tracker": {
                  "name": "inventory_tracker",
                  "description": "表明是否开启库存追踪。\n- `true`：开启库存追踪。\n- `false`：不开启库存追踪。\n\n默认值：`true`",
                  "type": "boolean"
                },
                "option4": {
                  "name": "option4",
                  "description": "款式第四个规格的信息。<br/>\n最大长度限制：255",
                  "type": "string",
                  "example": "short"
                },
                "option5": {
                  "name": "option5",
                  "description": "款式第五个规格的信息。<br/>\n最大长度限制：255",
                  "type": "string",
                  "example": "red"
                },
                "barcode": {
                  "name": "barcode",
                  "description": "款式的条形码。<br/>\n最大长度限制：255",
                  "type": "string",
                  "example": "T0000001"
                },
                "compare_at_price": {
                  "name": "compare_at_price",
                  "description": "款式的原价，数值保留到小数点后两位。<br/>默认值: `0`",
                  "type": "string",
                  "example": "129.99"
                },
                "inventory_policy": {
                  "name": "inventory_policy",
                  "description": "表明款式是否允许超卖。\n- `deny`：不允许超卖。\n- `continue`：允许超卖。\n\n默认值: `deny`",
                  "type": "string"
                },
                "taxable": {
                  "name": "taxable",
                  "description": "表明款式是否需要收税。\n- `true`：需要收税。\n- `false`：不需要收税。\n\n默认值: `true`",
                  "type": "boolean"
                },
                "weight": {
                  "name": "weight",
                  "description": "款式的重量，要求大于 0，超过两位小数向上取整。",
                  "type": "string",
                  "example": "0.23"
                },
                "image": {
                  "name": "image",
                  "description": "款式的图片。",
                  "type": "object",
                  "properties": {
                    "alt": {
                      "name": "alt",
                      "description": "款式图的替代文本描述，通常是具有图片特征或内容的单词或短语。<br/>\n最大长度限制：512",
                      "type": "string",
                      "example": "This is an image alt"
                    },
                    "id": {
                      "name": "id",
                      "description": "款式图的唯一标识 ID。<br/>\n最大长度限制：64 ",
                      "type": "string",
                      "example": "5759070976424132652"
                    },
                    "src": {
                      "name": "src",
                      "description": "款式图的链接，以 URL 形式展示。<br/>\n最大长度限制：255",
                      "type": "string",
                      "example": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                    }
                  },
                  "example": {
                    "alt": "This is an image alt",
                    "id": "5759070976424132652",
                    "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                  }
                },
                "option1": {
                  "name": "option1",
                  "description": "款式第一个规格的信息。<br/>\n最大长度限制：255",
                  "type": "string",
                  "example": "red"
                },
                "option2": {
                  "name": "option2",
                  "description": "款式第二个规格的信息。<br/>\n最大长度限制：255",
                  "type": "string",
                  "example": "xl"
                },
                "option3": {
                  "name": "option3",
                  "description": "款式第三个规格的信息。<br/>\n最大长度限制：255",
                  "type": "string",
                  "example": "cotton"
                },
                "price": {
                  "name": "price",
                  "description": "款式的售价，数值保留到小数点后两位。<br/>默认值：`0`",
                  "type": "string",
                  "example": "90.22"
                },
                "required_shipping": {
                  "name": "required_shipping",
                  "description": "表明款式是否需要运输。\n- `true`：需要运输。\n- `false`：不需要运输。\n\n默认值：`true`",
                  "type": "boolean"
                },
                "sku": {
                  "name": "sku",
                  "description": "商家为款式自定义的标识，区别于 SHOPLINE 生成的 `variant.id`。<br/>\n最大个数限制：255",
                  "type": "string",
                  "example": "S0000001"
                }
              },
              "example": {
                "image": {
                  "alt": "This is an image alt",
                  "id": "5759070976424132652",
                  "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                },
                "option2": "xl",
                "sku": "S0000001",
                "weight_unit": null,
                "compare_at_price": "129.99",
                "inventory_policy": null,
                "barcode": "T0000001",
                "inventory_tracker": null,
                "option1": "red",
                "option3": "cotton",
                "option4": "short",
                "price": "90.22",
                "taxable": null,
                "weight": "0.23",
                "option5": "red",
                "required_shipping": null
              }
            }
          },
          "example": {
            "variant": {
              "required_shipping": null,
              "compare_at_price": "129.99",
              "inventory_tracker": null,
              "option1": "red",
              "option2": "xl",
              "option4": "short",
              "inventory_policy": null,
              "option5": "red",
              "taxable": null,
              "weight": "0.23",
              "sku": "S0000001",
              "barcode": "T0000001",
              "option3": "cotton",
              "price": "90.22",
              "image": {
                "alt": "This is an image alt",
                "id": "5759070976424132652",
                "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
              },
              "weight_unit": null
            }
          }
        },
        "examples": {
          "创建商品款式": {
            "description": "创建商品款式。",
            "value": {
              "variant": {
                "weight_unit": "kg",
                "compare_at_price": "99",
                "image": {
                  "alt": "This is an image alt",
                  "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                },
                "inventory_policy": "continue",
                "inventory_tracker": "true",
                "price": "90",
                "sku": "S0000001",
                "barcode": "T0000001",
                "option1": "S",
                "option2": "White",
                "required_shipping": "true",
                "taxable": "true",
                "weight": "0.5"
              }
            }
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。",
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "name": "body",
            "type": "object",
            "properties": {
              "variant": {
                "name": "variant",
                "description": "商品款式信息。",
                "type": "object",
                "properties": {
                  "inventory_tracker": {
                    "name": "inventory_tracker",
                    "description": "表明是否开启库存追踪。\n- `true`：开启库存追踪。\n- `false`：不开启库存追踪。",
                    "type": "boolean"
                  },
                  "weight": {
                    "name": "weight",
                    "description": "款式的重量，超过两位小数时向上取整。",
                    "type": "string",
                    "example": "0.23"
                  },
                  "option1": {
                    "name": "option1",
                    "description": "款式第一个规格的信息。",
                    "type": "string",
                    "example": "red"
                  },
                  "option3": {
                    "name": "option3",
                    "description": "款式第三个规格的信息。",
                    "type": "string",
                    "example": "cotton"
                  },
                  "option5": {
                    "name": "option5",
                    "description": "款式第五个规格的信息。",
                    "type": "string",
                    "example": "casual"
                  },
                  "taxable": {
                    "name": "taxable",
                    "description": "表明款式是否需要收税。\n- `true`：需要收税。\n- `false`：不需要收税。",
                    "type": "boolean"
                  },
                  "id": {
                    "name": "id",
                    "description": "款式的唯一标识 ID。",
                    "type": "string",
                    "example": "18057039439794751459380282"
                  },
                  "inventory_item_id": {
                    "name": "inventory_item_id",
                    "description": "库存单位的唯一标识 ID。",
                    "type": "string",
                    "example": "5985060242375689228"
                  },
                  "inventory_policy": {
                    "name": "inventory_policy",
                    "description": "表明款式是否允许超卖。\n- `deny`：不允许超卖。\n- `continue`：允许超卖。",
                    "type": "string"
                  },
                  "option2": {
                    "name": "option2",
                    "description": "款式第二个规格的信息。",
                    "type": "string",
                    "example": "xl"
                  },
                  "weight_unit": {
                    "name": "weight_unit",
                    "description": "款式的重量单位。有效枚举值包含：\n- `g`：克\n- `kg`：千克\n- `lb`：磅\n- `oz`：盎司\n- `zh_kg`：公斤",
                    "type": "string"
                  },
                  "created_at": {
                    "name": "created_at",
                    "description": "款式的创建时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。",
                    "type": "string",
                    "example": "2021-09-02T14:11:54+00:00"
                  },
                  "inventory_quantity": {
                    "name": "inventory_quantity",
                    "description": "各存放地点的库存数量总和。",
                    "type": "integer",
                    "example": 99
                  },
                  "option4": {
                    "name": "option4",
                    "description": "款式第四个规格的信息。",
                    "type": "string",
                    "example": "short"
                  },
                  "price": {
                    "name": "price",
                    "description": "款式的售价，数值保留到小数点后两位。\n",
                    "type": "string",
                    "example": "90.22"
                  },
                  "product_id": {
                    "name": "product_id",
                    "description": "款式对应商品的唯一标识 ID。",
                    "type": "string",
                    "example": "16057039432335097907370282"
                  },
                  "required_shipping": {
                    "name": "required_shipping",
                    "description": "表明款式是否需要运输。\n- `true`：需要运输。\n- `false`：不需要运输。",
                    "type": "boolean"
                  },
                  "sku": {
                    "name": "sku",
                    "description": "商家为款式自定义的标识，区别于 SHOPLINE 生成的 `variant.id`。",
                    "type": "string",
                    "example": "S00000001"
                  },
                  "updated_at": {
                    "name": "updated_at",
                    "description": "款式最近一次更新的时间。格式：[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)。",
                    "type": "string",
                    "example": "2021-09-02T14:11:54+00:00"
                  },
                  "barcode": {
                    "name": "barcode",
                    "description": "款式的条形码。",
                    "type": "string",
                    "example": "T000000001"
                  },
                  "compare_at_price": {
                    "name": "compare_at_price",
                    "description": "款式的原价，数值保留到小数点后两位。",
                    "type": "string",
                    "example": "129.99"
                  },
                  "image": {
                    "name": "image",
                    "description": "款式的图片。",
                    "type": "object",
                    "properties": {
                      "alt": {
                        "name": "alt",
                        "description": "款式图的替代文本描述，通常是具有图片特征或内容的单词或短语。",
                        "type": "string",
                        "example": "This is an image alt."
                      },
                      "id": {
                        "name": "id",
                        "description": "款式图的唯一标识 ID。",
                        "type": "string",
                        "example": "5785060242207917075"
                      },
                      "src": {
                        "name": "src",
                        "description": "款式图的链接，以 URL 形式展示。",
                        "type": "string",
                        "example": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                      }
                    },
                    "example": {
                      "id": "5785060242207917075",
                      "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
                      "alt": "This is an image alt."
                    }
                  }
                },
                "example": {
                  "created_at": "2021-09-02T14:11:54+00:00",
                  "id": "18057039439794751459380282",
                  "inventory_quantity": 99,
                  "option4": "short",
                  "required_shipping": null,
                  "inventory_tracker": null,
                  "option2": "xl",
                  "option3": "cotton",
                  "product_id": "16057039432335097907370282",
                  "sku": "S00000001",
                  "taxable": null,
                  "inventory_item_id": "5985060242375689228",
                  "option1": "red",
                  "price": "90.22",
                  "updated_at": "2021-09-02T14:11:54+00:00",
                  "weight_unit": null,
                  "barcode": "T000000001",
                  "compare_at_price": "129.99",
                  "image": {
                    "alt": "This is an image alt.",
                    "id": "5785060242207917075",
                    "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                  },
                  "inventory_policy": null,
                  "option5": "casual",
                  "weight": "0.23"
                }
              }
            },
            "example": {
              "variant": {
                "inventory_quantity": 99,
                "option3": "cotton",
                "option4": "short",
                "required_shipping": null,
                "sku": "S00000001",
                "taxable": null,
                "image": {
                  "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
                  "alt": "This is an image alt.",
                  "id": "5785060242207917075"
                },
                "inventory_tracker": null,
                "option1": "red",
                "option2": "xl",
                "weight": "0.23",
                "weight_unit": null,
                "inventory_item_id": "5985060242375689228",
                "option5": "casual",
                "updated_at": "2021-09-02T14:11:54+00:00",
                "barcode": "T000000001",
                "compare_at_price": "129.99",
                "id": "18057039439794751459380282",
                "inventory_policy": null,
                "price": "90.22",
                "product_id": "16057039432335097907370282",
                "created_at": "2021-09-02T14:11:54+00:00"
              }
            }
          }
        }
      }
    },
    "201": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "name": "errors",
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          },
          "examples": {
            "创建商品款式": {
              "description": "创建商品款式。",
              "value": {
                "variant": {
                  "sku": "S0000001",
                  "updated_at": "2023-08-29T15:32:54+08:00",
                  "weight_unit": "kg",
                  "barcode": "T0000001",
                  "inventory_policy": "continue",
                  "option2": "White",
                  "taxable": true,
                  "id": "18060895634402500988513144",
                  "image": {
                    "alt": "This is an image alt",
                    "id": "6089563432963689533",
                    "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                  },
                  "inventory_item_id": "6089563439612587791",
                  "required_shipping": true,
                  "compare_at_price": "99.00",
                  "inventory_tracker": true,
                  "option1": "S",
                  "price": "90.00",
                  "weight": "0.50",
                  "created_at": "2023-08-29T15:32:54+08:00",
                  "product_id": "16060895302856191591063144"
                }
              }
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "post",
  "path": "/products/:product_id/variants.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。"
        }
      }
    }
  ],
  "info": {
    "title": "创建商品款式",
    "version": "v20270301"
  },
  "authIndexes": [
    "write_products"
  ]
}
```