VI | EN
Message us on Messenger
Developer resources

Update Inventory — TikTok Shop API

tiktok.product.202309.products.product_id.inventory.update · call it through Quantri360 with one API key for your own accounts / assets that you connected and authorized — 360 handles request signing and refreshing the authorization you granted.

tiktok.product.202309.products.product_id.inventory.update

POST/product/202309/products/{product_id}/inventory/updateVia 360: POST https://partner.quantri360.com/v1/tiktok/product/202309/products/{product_id}/inventory/update
Write endpoint — changes data on TikTok Shop. The key must be created with "Allow write API calls" ticked, otherwise you get 403 write_not_allowed. Every call is logged.
Description

Cập nhật tồn kho các SKU của MỘT sản phẩm theo từng kho — dùng để đẩy tồn từ kho / POS của bạn lên TikTok, tránh bán vượt tồn.

  • Là API GHI — thay đổi dữ liệu thật trên TikTok Shop (tồn kho bán được); key cần quyền ghi.
  • code = 0 VẪN có thể kèm data.errors — xét từng SKU, không coi cả lệnh là thành công.
  • warehouse_id lấy ở GET /logistics/202309/warehouses (kho SALES_WAREHOUSE) hoặc skus[].inventory[].warehouse_id của sản phẩm.
  • Ghép SKU bằng seller_sku (GET /product/202309/products/{product_id} hoặc products/search) → id.

Request

Endpoint

POST https://partner.quantri360.com/v1/tiktok/product/202309/products/{product_id}/inventory/update

Authentication & shop

NameInTypeSampleDescription
AuthorizationheaderheaderBearer q360_live_ab12cd34_…Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand.
platform_shop_idquerystring100001Gian hàng (lấy ở GET /v1/platforms → shops[].platform_shop_id). BẮT BUỘC khi brand có > 1 gian hàng trên nền tảng; 360 bỏ tham số này trước khi chuyển tiếp.

Request parameters

NameInTypeRequiredSampleDescription
product_idpathstringYes9000000000000000077Mã sản phẩm (trạng thái DRAFT, PENDING, FAILED, ACTIVATE hoặc SELLER_DEACTIVATED).
skusbodyobject[]Yes[{"id":"1729558934771698456","inventory":[{"warehouse_id":"9000000000000000022","quantity":12}]}]Mỗi phần tử: id (mã SKU — mọi SKU phải cùng sản phẩm), inventory [{warehouse_id, quantity (1–99.999, tồn có sẵn)}]. Phải liệt kê ĐỦ mọi kho đang gán cho SKU, không thêm kho lạ. backorder_quantity + handling_time (hàng đặt trước) gửi cùng nhau nếu dùng.

Request examples

curl -s -X POST "https://partner.quantri360.com/v1/tiktok/product/202309/products/9000000000000000077/inventory/update?platform_shop_id=7494000000000000000" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"skus":[{"id":"1729558934771698456","inventory":[{"warehouse_id":"9000000000000000022","quantity":12}]}]}'
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.post(
    "https://partner.quantri360.com/v1/tiktok/product/202309/products/9000000000000000077/inventory/update",
    params={
        "platform_shop_id": "7494000000000000000"
    },
    json={
        "skus": [
            {
                "id": "1729558934771698456",
                "inventory": [
                    {
                        "warehouse_id": "9000000000000000022",
                        "quantity": 12
                    }
                ]
            }
        ]
    },
    headers={"Authorization": f"Bearer {KEY}"},
    timeout=60,
)
print(r.status_code)
print(r.json())
Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/tiktok/product/202309/products/9000000000000000077/inventory/update');
for (const [k, v] of Object.entries({"platform_shop_id":"7494000000000000000"})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
  method: 'POST',
  headers: { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({"skus":[{"id":"1729558934771698456","inventory":[{"warehouse_id":"9000000000000000022","quantity":12}]}]}),
});
console.log(r.status, await r.json());
PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/tiktok/product/202309/products/9000000000000000077/inventory/update' . '?' . http_build_query(['platform_shop_id' => '7494000000000000000']);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key, 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"skus":[{"id":"1729558934771698456","inventory":[{"warehouse_id":"9000000000000000022","quantity":12}]}]}');
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;

Response

Response fields (as returned by TikTok Shop)

NameTypeSampleDescription
codeint00 = thành công; khác 0 xem message (105001–105003 = token, 360 đã tự làm mới một lần).
messagestringSuccessThông điệp của TikTok.
request_idstring2025101900000000000000000000Mã request TikTok.
dataobjectDữ liệu.
errorsobject[]Lỗi riêng từng SKU / kho: [{code, message, detail{sku_id, extra_errors[{warehouse_id, code, message}]}}].

Response sample

{
  "code": 0,
  "message": "Success",
  "request_id": "202203070749000101…",
  "data": {
    "errors": [
      {
        "code": 12052990,
        "message": "Batch update inventory error.",
        "detail": {
          "sku_id": "1729592969712207013",
          "extra_errors": [
            {
              "warehouse_id": "7068517275539719942",
              "code": 12052097,
              "message": "The warehouse does not exist"
            }
          ]
        }
      }
    ]
  }
}

Get started

  1. Sign up for Partner
  2. Enable a data type of the Sản phẩm group on the platform page
  3. Create an API key (tick the TikTok Shop channel)
  4. Call it as in the examples above