---
updatedAt: 2026-05-27T07:01:03.000Z
agentTools:
  projectIndex: https://open-api.docs.shoplineapp.com/llms.txt
---

# Update Gift Stock

To update the gift stock with its ID<br> 使用商品 ID 更新贈品在各個倉庫的庫存

# OpenAPI definition

```json
{
  "info": {
    "title": "SHOPLINE Open API",
    "version": "2.348.2",
    "description": "Welcome to the shopline open-api developer hub. You'll find comprehensive guides and documentation to help you start working with shopline open-api as quickly as possible, as well as support if you get stuck. Let's jump right in!"
  },
  "servers": [
    {
      "url": "https://open.shopline.io/v1",
      "description": "Production"
    }
  ],
  "openapi": "3.0.0",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "Translatable": {
        "type": "object",
        "properties": {
          "en": {
            "type": "string",
            "description": "Merchant defined English name<br>店家定義英文名稱"
          },
          "zh-hant": {
            "type": "string",
            "description": "Merchant defined Traditional Chinese name<br>店家定義繁體中文名稱"
          },
          "zh-cn": {
            "type": "string",
            "description": "Merchant defined Simplified Chinese name<br>店家定義簡體中文名稱"
          },
          "vi": {
            "type": "string",
            "description": "Merchant defined Vietnamese name<br>店家定義越南文名稱"
          },
          "ms": {
            "type": "string",
            "description": "Merchant defined Malaysian name<br>店家定義馬來西亞文名稱"
          },
          "ja": {
            "type": "string",
            "description": "Merchant defined Japanese name<br>店家定義日文名稱"
          },
          "th": {
            "type": "string",
            "description": "Merchant defined Thai name<br>店家定義泰文名稱"
          },
          "id": {
            "type": "string",
            "description": "Merchant defined Indian name<br>店家定義印度文名稱"
          },
          "de": {
            "type": "string",
            "description": "Merchant defined Deutsch name<br>店家定義德文名稱"
          },
          "fr": {
            "type": "string",
            "description": "Merchant defined France name<br>店家定義法文名稱"
          }
        }
      },
      "TranslatableArray": {
        "type": "object",
        "properties": {
          "en": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant defined English name<br>店家定義英文名稱"
          },
          "zh-hant": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant defined Traditional Chinese name<br>店家定義繁體中文名稱"
          },
          "zh-cn": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant defined Simplified Chinese name<br>店家定義簡體中文名稱"
          },
          "vi": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant defined Vietnamese name<br>店家定義越南文名稱"
          },
          "ms": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant defined Malaysian name<br>店家定義馬來西亞文名稱"
          },
          "ja": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant defined Japanese name<br>店家定義日文名稱"
          },
          "th": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant defined Thai name<br>店家定義泰文名稱"
          },
          "id": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant defined Indian name<br>店家定義印度文名稱"
          },
          "de": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant defined Deutsch name<br>店家定義德文名稱"
          },
          "fr": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Merchant defined France name<br>店家定義法文名稱"
          }
        },
        "example": "{\"en\": [\"green\", \"L1\"], \"zh-hant\": [\"綠\", \"大1\"]}"
      },
      "ProductStock": {
        "type": "object",
        "properties": {
          "id": {
            "description": "Product's ID<br>商品ID",
            "type": "string",
            "example": "5d3594c276e7ec003b7021c0"
          },
          "title_translations": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Translatable"
              },
              {
                "description": "Title translations<br>商品名稱",
                "example": {
                  "en": "testing SL-8049",
                  "zh-hant": "測試 SL-8049 round 2"
                }
              }
            ]
          },
          "unlimited_quantity": {
            "description": "Unlimited product quantity or not.<br>商品數量是否無限",
            "type": "boolean",
            "enum": [
              true,
              false
            ],
            "example": "false"
          },
          "stocks": {
            "description": "Product's Stock<br>庫存",
            "type": "object",
            "properties": {
              "warehouse_id": {
                "type": "string"
              },
              "quantity": {
                "type": "integer"
              }
            }
          },
          "variations": {
            "description": "Product's Variation<br>規格品",
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "fields_translations": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TranslatableArray"
                  },
                  {
                    "description": "Product variation name<br>規格名稱",
                    "example": {
                      "en": [
                        "Red",
                        "M"
                      ],
                      "zh-hant": [
                        "紅",
                        "中"
                      ]
                    }
                  }
                ]
              },
              "stocks": {
                "type": "object",
                "properties": {
                  "warehouse_id": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      },
      "ServerError": {
        "type": "object",
        "properties": {
          "message": {
            "description": "A detailed message of the reason of failure",
            "example": "Unable to create EventTrackers",
            "type": "string"
          },
          "code": {
            "description": "An error code",
            "example": "UnknownError",
            "type": "string"
          }
        }
      },
      "NotFoundError": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "example": "Unable to find the resource"
          },
          "code": {
            "type": "string",
            "example": "NOT_FOUND"
          },
          "extras": {
            "description": "Optional, Extra information about the error",
            "example": {},
            "type": "object"
          }
        }
      }
    }
  },
  "paths": {
    "/gifts/{id}/stocks": {
      "put": {
        "summary": "Update Gift Stock",
        "description": "To update the gift stock with its ID<br> 使用商品 ID 更新贈品在各個倉庫的庫存",
        "parameters": [
          {
            "name": "id",
            "description": "Gift ID<br>贈品ID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "5d3594c276e7ec003b7021c0"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "warehouse_id": {
                    "description": "Warehouse’s id<br>倉庫 id<br>-----<br>Only warehouse with status \"active\" can be updated<br>只有 status “active” 的 warehouse stock 的可以更新",
                    "type": "string",
                    "example": "5ee819deab591e00169a4618"
                  },
                  "quantity": {
                    "description": "Quantity<br>(新增/減少)商品數量<br><br>Negative number is allowed<br>允許更新庫存為負值",
                    "type": "number",
                    "example": 21
                  },
                  "is_replace": {
                    "description": "Whether replacing the original quantity<br>是否取代原本數量<br><br>true: replace the product's quantity with the number you provided<br>取代原本數量<br><br>false: increase/decrease the quantity with the number you provided<br>增加/減少數量",
                    "type": "boolean",
                    "example": false
                  }
                },
                "required": [
                  "warehouse_id",
                  "quantity"
                ]
              }
            }
          }
        },
        "tags": [
          "Gifts"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductStock"
                }
              }
            }
          },
          "404": {
            "description": "Not found error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundError"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServerError"
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Gifts",
      "description": "Operations about gifts"
    }
  ]
}
```