tiktok.affiliate_creator.202511.photos.photo_files
POST/affiliate_creator/202511/photos/photo_filesVia 360: POST https://partner.quantri360.com/v1/tiktok/affiliate_creator/202511/photos/photo_files
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
DÀNH CHO CREATOR: Tải ảnh trước khi đăng nội dung ảnh có gắn sản phẩm; lấy photo_file_uri từ kết quả.
- HIỆN CHƯA GỌI ĐƯỢC QUA 360: API này dùng kết nối của creator / đối tác, kết nối gian hàng trả code 36009005. Cần dùng → liên hệ 360.
- 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 đăng nội dung ảnh có gắn sản phẩm; lấy photo_file_uri từ kết quả.
- 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_creator/202511/photos/photo_files
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, JPEG, PNG, WEBP, HEIC hoặc BMP; không rỗng, tối đa 10 MiB (10.485.760 byte), tỷ lệ 9:16 đến 16:9. |
Request examples
curl -s -X POST "https://partner.quantri360.com/v1/tiktok/affiliate_creator/202511/photos/photo_files" \ -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_creator/202511/photos/photo_files", 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_creator/202511/photos/photo_files');
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_creator/202511/photos/photo_files');
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. | |
| photo_file | object | Ảnh tệp. | |
| photo_uri | string | DEMO_FILE_URI | Ảnh uri. |
Response sample
{
"code": 0,
"message": "Success",
"request_id": "DEMO_AFFILIATE_REQUEST",
"data": {
"photo_file": {
"photo_uri": "DEMO_FILE_URI"
}
}
}
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