tiktok.affiliate_seller.202511.images.upload
POST/affiliate_seller/202511/images/uploadVia 360: POST https://partner.quantri360.com/v1/tiktok/affiliate_seller/202511/images/upload
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
Tải ảnh trước khi gửi tin nhắn có ảnh cho creator.
- Gọi qua /v1/tiktok/affiliate_seller/202511/images/upload 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 affiliate. Tải ảnh trước khi gửi tin nhắn có ảnh cho creator.
- HTTP 200 vẫn có thể có lỗi nghiệp vụ; kiểm code trước khi dùng kết quả.
- Tham số data là tệp. 360 hiện chưa hỗ trợ nhận multipart cho API này; mẫu tải tệp minh họa định dạng, cần liên hệ 360 trước khi dùng.
Request
Endpoint
POST https://partner.quantri360.com/v1/tiktok/affiliate_seller/202511/images/upload
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 |
|---|---|---|---|---|---|
| data | body | file | Yes | /duong-dan/anh-minh-hoa.png | Tệp ảnh jpg, gif, webp hoặc png, tối đa 10 MB; không chấp nhận tệp rỗng. |
Request examples
curl -s -X POST "https://partner.quantri360.com/v1/tiktok/affiliate_seller/202511/images/upload" \ -H "Authorization: Bearer $KEY" \ -F "data=@/duong-dan/anh-minh-hoa.png"
Python
import requests
from contextlib import ExitStack
KEY = "q360_live_..."
with ExitStack() as stack:
files = [("data", stack.enter_context(open("/duong-dan/anh-minh-hoa.png", "rb")))]
r = requests.post("https://partner.quantri360.com/v1/tiktok/affiliate_seller/202511/images/upload", params={}, data={}, files=files, headers={"Authorization": f"Bearer {KEY}"}, timeout=60)
print(r.status_code, r.json())Node.js
import { readFile } from 'node:fs/promises';
const KEY = 'q360_live_...';
const url = new URL('https://partner.quantri360.com/v1/tiktok/affiliate_seller/202511/images/upload');
const form = new FormData();
form.append("data", new Blob([await readFile("/duong-dan/anh-minh-hoa.png")]), "/duong-dan/anh-minh-hoa.png");
const r = await fetch(url, { method: 'POST', headers: { Authorization: `Bearer ${KEY}` }, body: form });
console.log(r.status, await r.json());PHP
<?php
$key = 'q360_live_...';
$ch = curl_init('https://partner.quantri360.com/v1/tiktok/affiliate_seller/202511/images/upload');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, ['data' => new CURLFile('/duong-dan/anh-minh-hoa.png')]);
echo curl_exec($ch);
curl_close($ch);Response
Response fields (as returned by TikTok Shop)
| Name | Type | Sample | Description |
|---|---|---|---|
| code | int | 0 | Mã kết quả; 0 là thành công. |
| message | string | Success | Thông báo kết quả. |
| request_id | string | DEMO_AFFILIATE_REQUEST | Mã truy vết yêu cầu. |
| data | object | Dữ liệu phản hồi. | |
| url | string | https://example.com/minh-hoa | URL minh họa. |
| width | int | 1 | Chiều rộng ảnh, đơn vị pixel. |
| height | int | 1 | Chiều cao ảnh, đơn vị pixel. |
Response sample
{
"code": 0,
"message": "Success",
"request_id": "DEMO_AFFILIATE_REQUEST",
"data": {
"url": "https://example.com/minh-hoa",
"width": 1,
"height": 1
}
}
Get started
- Sign up for Partner
- Enable a data type of the Affiliate group on the platform page
- Create an API key (tick the TikTok Shop channel)
- Call it as in the examples above