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 = 0VẪN có thể kèmdata.errors— xét từng SKU, không coi cả lệnh là thành công.warehouse_idlấy ở GET /logistics/202309/warehouses (khoSALES_WAREHOUSE) hoặcskus[].inventory[].warehouse_idcủ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
| Name | In | Type | Sample | Description |
|---|---|---|---|---|
| Authorization | header | header | Bearer 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_id | query | string | 100001 | Gian 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
| Name | In | Type | Required | Sample | Description |
|---|---|---|---|---|---|
| product_id | path | string | Yes | 9000000000000000077 | Mã sản phẩm (trạng thái DRAFT, PENDING, FAILED, ACTIVATE hoặc SELLER_DEACTIVATED). |
| skus | body | object[] | 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)
| Name | Type | Sample | Description |
|---|---|---|---|
| code | int | 0 | 0 = thành công; khác 0 xem message (105001–105003 = token, 360 đã tự làm mới một lần). |
| message | string | Success | Thông điệp của TikTok. |
| request_id | string | 2025101900000000000000000000 | Mã request TikTok. |
| data | object | Dữ liệu. | |
| errors | object[] | 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
- Sign up for Partner
- Enable a data type of the Sản phẩm group on the platform page
- Create an API key (tick the TikTok Shop channel)
- Call it as in the examples above