---
title: "新增商品到销售渠道"
description: "将商品添加到销售渠道中"
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/webhook/sales-channels/add-product-to-sales-channels'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/webhook/sales-channels/add-product-to-sales-channels.md'
---
# 新增商品到销售渠道

将商品添加到销售渠道中

- **API Version:** v20270301
- **API Type:** Webhook
- **API Protocol:** RESTful

## Request

### Request Headers

* `X-Shopline-Topic`

  string (required)

  事件的唯一标识。

* `X-Shopline-Hmac-Sha256`

  string (required)

  该请求的签名。收到请求后，你需要对该签名进行 [验签](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/generate-and-verify-signatures.md#post-请求操作步骤) 以验证数据的真实性和完整性。

* `X-Shopline-Shop-Domain`

  string (required)

  店铺的域名。

* `X-Shopline-Shop-Id`

  string (required)

  店铺 ID。

* `X-Shopline-Merchant-Id`

  string (required)

  商家 ID。

* `X-Shopline-API-Version`

  string (required)

  API 版本号。

* `X-Shopline-Webhook-Id`

  string (required)

  该 Webhook 事件的 ID。

### Request Body

* `product_listing`

  object

  商品信息

  * `body_html`

    string

    商品描述

  * `created_at`

    string

    商品创建时间

  * `handle`

    string

    全局唯一的商品handle

  * `id`

    string

    商品id

  * `images`

    array<object>

    商品主图列表

    * `alt`

      string

      图片ALT

    * `src`

      string

      图片地址

  * `options`

    array<object>

    选项列表

    * `id`

      string

      选项ID

    * `name`

      string

      选项名称

    * `option_values`

      array<object>

      选项值列表。

      * `id`

        string

        选项值 ID。

      * `value`

        string

        选项值。

    * `product_id`

      string

      对应的商品ID

    * `values`

      array<string>

      选项值列表。与 option_values 返回数据一致，不包含选项值 ID。

    * `values_images`

      map

      选项值图

  * `product_behavior`

    string

    商品行为

  * `product_category`

    string

    商品聚合类型

  * `product_type`

    string

    商品类型

  * `published_at`

    string

    发布到在线商店的时间

  * `published_scope`

    string

    发布范围，「web」表示在线商店

  * `spu`

    string

    SPU码

  * `status`

    string

    商品状态：active - 上架，draft - 下架，archived - 归档

  * `subtitle`

    string

    商品摘要

  * `tags`

    string

    标签，多个用逗号分隔

  * `template_path`

    string

    主题模板

  * `title`

    string

    商品标题

  * `updated_at`

    string

    商品更新时间

  * `variants`

    array<object>

    款式列表

    * `barcode`

      string

      条形码

    * `compare_at_price`

      string

      原价

    * `id`

      string

      款式ID

    * `image`

      object

      款式图

      * `alt`

        string

        图片alt

      * `src`

        string

        图片src

    * `inventory_policy`

      string

      是否允许超卖，continue：允许，deny：不允许

    * `inventory_quantity`

      integer

      所有地点的库存数汇总

    * `inventory_tracker`

      boolean

      是否追踪库存

    * `option1`

      string

      该款式对应的第一个选项的值

    * `option2`

      string

      该款式对应的第二个选项的值

    * `option3`

      string

      该款式对应的第三个选项的值

    * `option4`

      string

      该款式对应的第四个选项的值

    * `option5`

      string

      该款式对应的第五个选项的值

    * `price`

      string

      售价

    * `product_id`

      string

      对应的商品ID

    * `required_shipping`

      boolean

      是否发货

    * `sku`

      string

      SKU码

    * `taxable`

      boolean

      是否收税

    * `title`

      string

      款式标题

    * `weight`

      string

      重量

    * `weight_unit`

      string

      重量单位， g：克，kg：千克，lb：磅，oz：盎司

  * `vendor`

    string

    商品厂商

## Response

### Status Codes

* `200`

  收到 SHOPLINE 发送的 Webhook 通知后，你需要按照如下 SHOPLINE 要求的格式进行响应。
  
  ``` HTTP/1.1 200 OK ``` 
  
  关于如何订阅 Webhooks 及更多 Webhook 响应规则说明，请参考 [Webhook 概述](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/webhooks/overview.md)。

### Response Body

#### 200

_No response body_

## OpenAPI Definition

```json
{
  "description": "将商品添加到销售渠道中",
  "externalDocs": {
    "description": "| 事件分组 | 事件标识 |\n| :------: | :------: |\n|product_listings        |product_listings/add        |\n",
    "url": "",
    "errorTableDescription": ""
  },
  "operationId": "JzwSl7sH",
  "parameters": [
    {
      "name": "X-Shopline-Topic",
      "in": "header",
      "description": "事件的唯一标识。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Topic",
        "description": "事件的唯一标识。",
        "type": "string",
        "example": "orders/edited"
      },
      "example": "orders/edited"
    },
    {
      "name": "X-Shopline-Hmac-Sha256",
      "in": "header",
      "description": "该请求的签名。收到请求后，你需要对该签名进行 [验签](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/generate-and-verify-signatures.md#post-请求操作步骤) 以验证数据的真实性和完整性。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Hmac-Sha256",
        "description": "该请求的签名。收到请求后，你需要对该签名进行 [验签](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/generate-and-verify-signatures.md#post-请求操作步骤) 以验证数据的真实性和完整性。",
        "type": "string",
        "example": "XWmrwMey6OsLMeiZKwP4FppHH3cmAiiJJAweH5Jo4bM="
      },
      "example": "XWmrwMey6OsLMeiZKwP4FppHH3cmAiiJJAweH5Jo4bM="
    },
    {
      "name": "X-Shopline-Shop-Domain",
      "in": "header",
      "description": "店铺的域名。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Shop-Domain",
        "description": "店铺的域名。",
        "type": "string",
        "example": "example.myshopline.com"
      },
      "example": "example.myshopline.com"
    },
    {
      "name": "X-Shopline-Shop-Id",
      "in": "header",
      "description": "店铺 ID。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Shop-Id",
        "description": "店铺 ID。",
        "type": "string",
        "example": "1610418123456"
      },
      "example": "1610418123456"
    },
    {
      "name": "X-Shopline-Merchant-Id",
      "in": "header",
      "description": "商家 ID。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Merchant-Id",
        "description": "商家 ID。",
        "type": "string",
        "example": "2000001234"
      },
      "example": "2000001234"
    },
    {
      "name": "X-Shopline-API-Version",
      "in": "header",
      "description": "API 版本号。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-API-Version",
        "description": "API 版本号。",
        "type": "string",
        "example": "v20250601"
      },
      "example": "v20250601"
    },
    {
      "name": "X-Shopline-Webhook-Id",
      "in": "header",
      "description": "该 Webhook 事件的 ID。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "X-Shopline-Webhook-Id",
        "description": "该 Webhook 事件的 ID。",
        "type": "string",
        "example": "b54557e48a5fbf7d70bcd043"
      },
      "example": "b54557e48a5fbf7d70bcd043"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "product_listing": {
              "name": "product_listing",
              "description": "商品信息",
              "type": "object",
              "properties": {
                "body_html": {
                  "name": "body_html",
                  "description": "商品描述",
                  "type": "string",
                  "example": "This is a description"
                },
                "created_at": {
                  "name": "created_at",
                  "description": "商品创建时间",
                  "type": "string",
                  "example": "2023-03-02T18:18:42.883+0800"
                },
                "handle": {
                  "name": "handle",
                  "description": "全局唯一的商品handle",
                  "type": "string",
                  "example": "proudct-handle"
                },
                "id": {
                  "name": "id",
                  "description": "商品id",
                  "type": "string",
                  "example": "16058287356753559620272670"
                },
                "images": {
                  "name": "images",
                  "description": "商品主图列表",
                  "type": "array",
                  "items": {
                    "name": "images",
                    "description": "商品主图列表",
                    "type": "object",
                    "properties": {
                      "alt": {
                        "name": "alt",
                        "description": "图片ALT",
                        "type": "string",
                        "example": "This is a image alt"
                      },
                      "src": {
                        "name": "src",
                        "description": "图片地址",
                        "type": "string",
                        "example": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                      }
                    },
                    "example": {
                      "alt": "This is a image alt",
                      "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                    }
                  },
                  "example": [
                    ""
                  ]
                },
                "options": {
                  "name": "options",
                  "description": "选项列表",
                  "type": "array",
                  "items": {
                    "name": "options",
                    "description": "选项列表",
                    "type": "object",
                    "properties": {
                      "id": {
                        "name": "id",
                        "description": "选项ID",
                        "type": "string",
                        "example": "16158288104774469113452670"
                      },
                      "name": {
                        "name": "name",
                        "description": "选项名称",
                        "type": "string",
                        "example": "Color"
                      },
                      "option_values": {
                        "name": "option_values",
                        "description": "选项值列表。",
                        "type": "array",
                        "items": {
                          "name": "option_values",
                          "description": "选项值列表。",
                          "type": "object",
                          "properties": {
                            "id": {
                              "name": "id",
                              "description": "选项值 ID。",
                              "type": "string",
                              "example": "16247051995358890915900034"
                            },
                            "value": {
                              "name": "value",
                              "description": "选项值。",
                              "type": "string",
                              "example": "Red"
                            }
                          },
                          "example": {
                            "id": "16247051995358890915900034",
                            "value": "Red"
                          }
                        },
                        "example": [
                          ""
                        ]
                      },
                      "product_id": {
                        "name": "product_id",
                        "description": "对应的商品ID",
                        "type": "string",
                        "example": "16058287356753569620272670"
                      },
                      "values": {
                        "name": "values",
                        "description": "选项值列表。与 option_values 返回数据一致，不包含选项值 ID。",
                        "type": "array",
                        "items": {
                          "name": "values",
                          "description": "选项值列表。与 option_values 返回数据一致，不包含选项值 ID。",
                          "type": "string",
                          "example": "[\"Red\", \"Green\", \"White\"]"
                        },
                        "example": [
                          "[\"Red\", \"Green\", \"White\"]"
                        ]
                      },
                      "values_images": {
                        "name": "values_images",
                        "description": "选项值图",
                        "type": "map",
                        "example": {}
                      }
                    },
                    "example": {
                      "id": "16158288104774469113452670",
                      "name": "Color",
                      "option_values": [
                        ""
                      ],
                      "product_id": "16058287356753569620272670",
                      "values": [
                        "[\"Red\", \"Green\", \"White\"]"
                      ],
                      "values_images": {}
                    }
                  },
                  "example": [
                    ""
                  ]
                },
                "product_behavior": {
                  "name": "product_behavior",
                  "description": "商品行为",
                  "type": "string",
                  "example": "RISK,HIDDEN"
                },
                "product_category": {
                  "name": "product_category",
                  "description": "商品聚合类型",
                  "type": "string",
                  "example": "Electronic"
                },
                "product_type": {
                  "name": "product_type",
                  "description": "商品类型",
                  "type": "string",
                  "example": "Electronic"
                },
                "published_at": {
                  "name": "published_at",
                  "description": "发布到在线商店的时间",
                  "type": "string",
                  "example": "2023-03-02T18:18:42.883+0800"
                },
                "published_scope": {
                  "name": "published_scope",
                  "description": "发布范围，「web」表示在线商店",
                  "type": "string",
                  "example": "web"
                },
                "spu": {
                  "name": "spu",
                  "description": "SPU码",
                  "type": "string",
                  "example": "S000000001"
                },
                "status": {
                  "name": "status",
                  "description": "商品状态：active - 上架，draft - 下架，archived - 归档",
                  "type": "string",
                  "example": "active"
                },
                "subtitle": {
                  "name": "subtitle",
                  "description": "商品摘要",
                  "type": "string",
                  "example": "This is a subtitle"
                },
                "tags": {
                  "name": "tags",
                  "description": "标签，多个用逗号分隔",
                  "type": "string",
                  "example": "tag1,tag2"
                },
                "template_path": {
                  "name": "template_path",
                  "description": "主题模板",
                  "type": "string",
                  "example": "templates/products/detail.json"
                },
                "title": {
                  "name": "title",
                  "description": "商品标题",
                  "type": "string",
                  "example": "This is a title"
                },
                "updated_at": {
                  "name": "updated_at",
                  "description": "商品更新时间",
                  "type": "string",
                  "example": "2023-03-02T18:18:42.883+0800"
                },
                "variants": {
                  "name": "variants",
                  "description": "款式列表",
                  "type": "array",
                  "items": {
                    "name": "variants",
                    "description": "款式列表",
                    "type": "object",
                    "properties": {
                      "barcode": {
                        "name": "barcode",
                        "description": "条形码",
                        "type": "string",
                        "example": "B0000000001"
                      },
                      "compare_at_price": {
                        "name": "compare_at_price",
                        "description": "原价",
                        "type": "string",
                        "example": "1"
                      },
                      "id": {
                        "name": "id",
                        "description": "款式ID",
                        "type": "string",
                        "example": "18058288104774469113432670"
                      },
                      "image": {
                        "name": "image",
                        "description": "款式图",
                        "type": "object",
                        "properties": {
                          "alt": {
                            "name": "alt",
                            "description": "图片alt",
                            "type": "string",
                            "example": "This is a image alt"
                          },
                          "src": {
                            "name": "src",
                            "description": "图片src",
                            "type": "string",
                            "example": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                          }
                        },
                        "example": {
                          "alt": "This is a image alt",
                          "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                        }
                      },
                      "inventory_policy": {
                        "name": "inventory_policy",
                        "description": "是否允许超卖，continue：允许，deny：不允许",
                        "type": "string",
                        "example": "continue"
                      },
                      "inventory_quantity": {
                        "name": "inventory_quantity",
                        "description": "所有地点的库存数汇总",
                        "type": "integer",
                        "example": 1
                      },
                      "inventory_tracker": {
                        "name": "inventory_tracker",
                        "description": "是否追踪库存",
                        "type": "boolean",
                        "example": true
                      },
                      "option1": {
                        "name": "option1",
                        "description": "该款式对应的第一个选项的值",
                        "type": "string",
                        "example": "Red"
                      },
                      "option2": {
                        "name": "option2",
                        "description": "该款式对应的第二个选项的值",
                        "type": "string",
                        "example": "L"
                      },
                      "option3": {
                        "name": "option3",
                        "description": "该款式对应的第三个选项的值",
                        "type": "string",
                        "example": ""
                      },
                      "option4": {
                        "name": "option4",
                        "description": "该款式对应的第四个选项的值",
                        "type": "string",
                        "example": ""
                      },
                      "option5": {
                        "name": "option5",
                        "description": "该款式对应的第五个选项的值",
                        "type": "string",
                        "example": ""
                      },
                      "price": {
                        "name": "price",
                        "description": "售价",
                        "type": "string",
                        "example": "1"
                      },
                      "product_id": {
                        "name": "product_id",
                        "description": "对应的商品ID",
                        "type": "string",
                        "example": "16058287356753569620272670"
                      },
                      "required_shipping": {
                        "name": "required_shipping",
                        "description": "是否发货",
                        "type": "boolean",
                        "example": false
                      },
                      "sku": {
                        "name": "sku",
                        "description": "SKU码",
                        "type": "string",
                        "example": "B0000001"
                      },
                      "taxable": {
                        "name": "taxable",
                        "description": "是否收税",
                        "type": "boolean",
                        "example": false
                      },
                      "title": {
                        "name": "title",
                        "description": "款式标题",
                        "type": "string",
                        "example": "Red/L"
                      },
                      "weight": {
                        "name": "weight",
                        "description": "重量",
                        "type": "string",
                        "example": "1"
                      },
                      "weight_unit": {
                        "name": "weight_unit",
                        "description": "重量单位， g：克，kg：千克，lb：磅，oz：盎司",
                        "type": "string",
                        "example": "g"
                      }
                    },
                    "example": {
                      "barcode": "B0000000001",
                      "compare_at_price": "1",
                      "id": "18058288104774469113432670",
                      "image": {
                        "alt": "This is a image alt",
                        "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                      },
                      "inventory_policy": "continue",
                      "inventory_quantity": 1,
                      "inventory_tracker": true,
                      "option1": "Red",
                      "option2": "L",
                      "option3": "",
                      "option4": "",
                      "option5": "",
                      "price": "1",
                      "product_id": "16058287356753569620272670",
                      "required_shipping": false,
                      "sku": "B0000001",
                      "taxable": false,
                      "title": "Red/L",
                      "weight": "1",
                      "weight_unit": "g"
                    }
                  },
                  "example": [
                    ""
                  ]
                },
                "vendor": {
                  "name": "vendor",
                  "description": "商品厂商",
                  "type": "string",
                  "example": "Shopline"
                }
              },
              "example": {
                "body_html": "This is a description",
                "created_at": "2023-03-02T18:18:42.883+0800",
                "handle": "proudct-handle",
                "id": "16058287356753559620272670",
                "images": [
                  ""
                ],
                "options": [
                  ""
                ],
                "product_behavior": "RISK,HIDDEN",
                "product_category": "Electronic",
                "product_type": "Electronic",
                "published_at": "2023-03-02T18:18:42.883+0800",
                "published_scope": "web",
                "spu": "S000000001",
                "status": "active",
                "subtitle": "This is a subtitle",
                "tags": "tag1,tag2",
                "template_path": "templates/products/detail.json",
                "title": "This is a title",
                "updated_at": "2023-03-02T18:18:42.883+0800",
                "variants": [
                  ""
                ],
                "vendor": "Shopline"
              }
            }
          },
          "example": {
            "product_listing": {
              "body_html": "This is a description",
              "created_at": "2023-03-02T18:18:42.883+0800",
              "handle": "proudct-handle",
              "id": "16058287356753559620272670",
              "images": [
                ""
              ],
              "options": [
                ""
              ],
              "product_behavior": "RISK,HIDDEN",
              "product_category": "Electronic",
              "product_type": "Electronic",
              "published_at": "2023-03-02T18:18:42.883+0800",
              "published_scope": "web",
              "spu": "S000000001",
              "status": "active",
              "subtitle": "This is a subtitle",
              "tags": "tag1,tag2",
              "template_path": "templates/products/detail.json",
              "title": "This is a title",
              "updated_at": "2023-03-02T18:18:42.883+0800",
              "variants": [
                ""
              ],
              "vendor": "Shopline"
            }
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "收到 SHOPLINE 发送的 Webhook 通知后，你需要按照如下 SHOPLINE 要求的格式进行响应。\n\n``` HTTP/1.1 200 OK ``` \n\n关于如何订阅 Webhooks 及更多 Webhook 响应规则说明，请参考 [Webhook 概述](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/webhooks/overview.md)。"
    }
  },
  "info": {
    "title": "新增商品到销售渠道",
    "version": "v20270301"
  }
}
```