VI | EN
Message us on Messenger
Developer resources

Upload Message Image — TikTok Shop API

tiktok.affiliate_seller.202511.images.upload · 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.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

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
databodyfileYes/duong-dan/anh-minh-hoa.pngTệ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)

NameTypeSampleDescription
codeint0Mã kết quả; 0 là thành công.
messagestringSuccessThông báo kết quả.
request_idstringDEMO_AFFILIATE_REQUESTMã truy vết yêu cầu.
dataobjectDữ liệu phản hồi.
urlstringhttps://example.com/minh-hoaURL minh họa.
widthint1Chiều rộng ảnh, đơn vị pixel.
heightint1Chiề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

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