tiktok.fulfillment.202309.packages.ship
POST/fulfillment/202309/packages/shipGọi qua 360: POST https://partner.quantri360.com/v1/tiktok/fulfillment/202309/packages/ship
Endpoint ghi — thay đổi dữ liệu trên TikTok Shop. Key phải được tạo với tick "Cho phép gọi API ghi", nếu không sẽ nhận 403 write_not_allowed. Mỗi lần gọi được ghi nhật ký.
Mô tả API
Xác nhận gửi nhiều kiện hàng.
- Gọi qua /v1/tiktok/fulfillment/202309/packages/ship với Authorization: Bearer <key>; dùng platform_shop_id khi có nhiều shop. 360 tự gắn app_key, shop_cipher, sign và access_token.
- API GHI: thay đổi dữ liệu thật trên TikTok Shop; cần key có quyền ghi (can_write) và gói mở module Đơn hàng. Xác nhận gửi nhiều kiện hàng.
- HTTP 200 vẫn có thể có lỗi nghiệp vụ; kiểm code trước khi dùng kết quả.
Request
Địa chỉ
POST https://partner.quantri360.com/v1/tiktok/fulfillment/202309/packages/ship
Xác thực & gian hàng
| Tên | Vị trí | Kiểu | Mẫu | Mô tả |
|---|---|---|---|---|
| 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. |
Tham số request
| Tên | Vị trí | Kiểu | Bắt buộc | Mẫu | Mô tả |
|---|---|---|---|---|---|
| packages | body | object[] | Có | Các kiện. | |
| packages[].id | body | string | Có | 100000000000000001 | Mã. |
| packages[].handover_method | body | string | Không | PICKUP | Bàn giao phương thức. Giá trị / trường liên quan: PICKUP, DROP_OFF. |
| packages[].pickup_slot | body | object | Không | Lấy hàng khung giờ. | |
| packages[].pickup_slot.start_time | body | int | Không | 1792650000 | Bắt đầu thời gian. Mốc Unix giây. |
| packages[].pickup_slot.end_time | body | int | Không | 1792650000 | Kết thúc thời gian. Mốc Unix giây. |
| packages[].self_shipment | body | object | Không | Tự vận chuyển. Giá trị / trường liên quan: delivery_option, shipping_provider_id. | |
| packages[].self_shipment.tracking_number | body | string | Có | JX12345 | Mã vận đơn. Giá trị / trường liên quan: SEND_BY_SELLER. |
| packages[].self_shipment.shipping_provider_id | body | string | Có | 100000000000000001 | Mã đơn vị vận chuyển. Giá trị / trường liên quan: SEND_BY_SELLER, shipping_provider_id. |
Ví dụ request
curl -s -X POST "https://partner.quantri360.com/v1/tiktok/fulfillment/202309/packages/ship" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"packages":[{"id":"100000000000000001","handover_method":"PICKUP","pickup_slot":{"start_time":1792650000,"end_time":1792650000},"self_shipment":{"tracking_number":"JX12345","shipping_provider_id":"100000000000000001"}}]}'
Python
import requests
KEY = "q360_live_..." # khóa API của brand
r = requests.post(
"https://partner.quantri360.com/v1/tiktok/fulfillment/202309/packages/ship",
params={},
json={
"packages": [
{
"id": "100000000000000001",
"handover_method": "PICKUP",
"pickup_slot": {
"start_time": 1792650000,
"end_time": 1792650000
},
"self_shipment": {
"tracking_number": "JX12345",
"shipping_provider_id": "100000000000000001"
}
}
]
},
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/fulfillment/202309/packages/ship');
for (const [k, v] of Object.entries({})) 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({"packages":[{"id":"100000000000000001","handover_method":"PICKUP","pickup_slot":{"start_time":1792650000,"end_time":1792650000},"self_shipment":{"tracking_number":"JX12345","shipping_provider_id":"100000000000000001"}}]}),
});
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/fulfillment/202309/packages/ship' . '?' . http_build_query([]);
$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, '{"packages":[{"id":"100000000000000001","handover_method":"PICKUP","pickup_slot":{"start_time":1792650000,"end_time":1792650000},"self_shipment":{"tracking_number":"JX12345","shipping_provider_id":"100000000000000001"}}]}');
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;Response
Tham số phản hồi (nguyên của TikTok Shop)
| Tên | Kiểu | Mẫu | Mô tả |
|---|---|---|---|
| code | int | 0 | Mã kết quả; 0 là thành công. |
| message | string | Success | Thông báo kết quả; khi lỗi, đọc nội dung để xử lý. |
| request_id | string | DEMO_REQUEST_0001 | Mã truy vết yêu cầu. |
| data | object | Dữ liệu. | |
| errors | object[] | Các lỗi. Giá trị / trường liên quan: code, 0. | |
| code | int | 0 | Mã kết quả; 0 là thành công. |
| message | string | Success | Thông báo kết quả; khi lỗi, đọc nội dung để xử lý. |
| detail | object | Chi tiết. | |
| package_id | string | 100000000000000001 | Mã kiện hàng. |
Mẫu phản hồi
{
"code": 0,
"message": "Success",
"request_id": "DEMO_REQUEST_0001",
"data": {
"errors": []
}
}
Mã lỗi của TikTok Shop (1)
Bấm để xem
| Mã | Ý nghĩa |
|---|---|
| SellerFulfillUnitInReverseCannotOperate | 21011001 Package not found. If the error persists, please contact the platform for assistance. 21011003 fulfill_unit action not allowed 21011007 Package item has after-sale request, please process the after-sale request first. 21011008 Package is not complete. If the error persists, please contact the platform for assistance. 21011020 These orders are already shipped. 21011022 Invalid tracking number or provider ID. Please double check and try again. 21011025 Duplicate tracking number. 21011027 Package has already been delivered. 21011028 The package does not belong to the current shop. Please ensure you are providing the correct package ID and/or shop cipher. 21011040 Package has already been shipped. 21011041 Cannot complete the operation when order is cancelled. 21011053 Fail to ship package because the shipment time is outside of the pick-up time slot. 21011054 No available shipping services for this request due to missing pick-up time slot. Please contact customer service for assistance. 21014009 Failed to ship. You may cancel the order without penalty by selecting the following reason: Unable to deliver to buyer address. 21042227 For pop 4pl(cross-border),the return warehouse for the shipping location has not been configured. 21042251 Abnormal order status, item cannot be shipped. |
Bắt đầu dùng
- Đăng ký tài khoản Partner
- Mở loại dữ liệu thuộc nhóm Đơn hàng ở trang nền tảng
- Tạo API key (tick kênh TikTok Shop)
- Gọi theo ví dụ ở trên