VI | EN
Message us on Messenger
Developer resources

Queries livestream performance data for the specified principal within the selected time range — Shopee API

v2.principal.get_principal_livestream_performance · 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.

v2.principal.get_principal_livestream_performance

POST/api/v2/principal/get_principal_livestream_performanceVia 360: POST https://partner.quantri360.com/v1/shopee/api/v2/principal/get_principal_livestream_performance
Description

CẤP PRINCIPAL: Tra cứu hiệu quả livestream của principal, trả tổng hợp và chi tiết theo khu vực.

  • HIỆN CHƯA GỌI ĐƯỢC QUA 360: đây là API cấp principal, 360 hiện ký theo gian hàng nên Shopee trả error_param "There is no principal_id in query.". Cần dùng API này → liên hệ 360.
  • Áp dụng: tài khoản principal (chủ thể quản lý nhiều gian hàng).
  • API chỉ đọc; error rỗng mới là thành công.
  • Khoảng ngày và biên kỳ kiểm theo timezone; xem start_date, end_date, granularity.
  • customize dùng độ chi tiết livestream tương thích tiếp thị liên kết. Doanh số gồm đã và chưa thanh toán; xem sales_gross và sales_net để phân biệt khoản bị loại.

Request

Endpoint

POST https://partner.quantri360.com/v1/shopee/api/v2/principal/get_principal_livestream_performance

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
start_datebodystringYes2026-10-01Ngày bắt đầu hợp lệ YYYY-MM-DD, không sau end_date; tính theo timezone. Mốc sớm nhất = ngày hiện tại theo timezone − 1 ngày − 2 năm. customize không được trước mốc này; day cùng ngày với end_date; week bắt đầu Chủ nhật; month ngày đầu tháng; quarter ngày đầu quý; year ngày đầu năm.
end_datebodystringYes2026-10-07Ngày kết thúc hợp lệ YYYY-MM-DD, không trước start_date. customize: không sau hôm qua theo timezone, tối đa 366 ngày tính cả hai đầu. day: bằng start_date. week: từ start_date đến min(start_date + 6 ngày, hôm qua). month/quarter/year: trong tháng/quý/năm đã chọn, không quá min(ngày cuối kỳ, hôm qua).
timezonebodystringYesGMT+7Múi giờ tính biên ngày, kiểm khoảng ngày và chuyển đổi dấu thời gian; chỉ GMT+7, GMT+8, GMT-3. Mọi kiểm tra ngày dùng múi giờ này.
granularitybodystringYescustomizeĐộ chi tiết: customize, day, week, month, quarter, year. customize là khoảng ngày tùy chọn; truy vấn với độ chi tiết livestream tương thích tiếp thị liên kết. day là một ngày; week theo tuần bắt đầu Chủ nhật; month/quarter/year theo tháng/quý/năm lịch. Giá trị khác bị từ chối với invalid_parameter.
region_listbodyobject[]NoBỏ qua hoặc [] lấy mọi khu vực thuộc principal, trừ nhóm khu vực tổng hợp; tối đa 100 khu vực, đều phải thuộc principal. Khu vực trùng được gộp khi lọc; dùng tiền tệ được cung cấp đầu tiên.
region_list[].regionbodystringYesSGMã khu vực hợp lệ được hỗ trợ, bắt buộc trong mỗi phần tử và phải thuộc principal.
region_list[].currencybodystringNoUSDTiền tệ LOCAL hoặc USD; bỏ qua mặc định USD, giá trị khác bị từ chối với invalid_parameter.

Request examples

curl -s -X POST "https://partner.quantri360.com/v1/shopee/api/v2/principal/get_principal_livestream_performance" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"start_date":"2026-10-01","end_date":"2026-10-07","timezone":"GMT+7","granularity":"customize","region_list":[]}'
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.post(
    "https://partner.quantri360.com/v1/shopee/api/v2/principal/get_principal_livestream_performance",
    params={},
    json={
        "start_date": "2026-10-01",
        "end_date": "2026-10-07",
        "timezone": "GMT+7",
        "granularity": "customize",
        "region_list": []
    },
    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/shopee/api/v2/principal/get_principal_livestream_performance');
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({"start_date":"2026-10-01","end_date":"2026-10-07","timezone":"GMT+7","granularity":"customize","region_list":[]}),
});
console.log(r.status, await r.json());
PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/shopee/api/v2/principal/get_principal_livestream_performance' . '?' . 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, '{"start_date":"2026-10-01","end_date":"2026-10-07","timezone":"GMT+7","granularity":"customize","region_list":[]}');
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;

Response

Response fields (as returned by Shopee)

Mẫu thành công chỉ dùng số liệu minh họa; kiểm error/message trước khi đọc response. response.summary và response.details là mảng.

NameTypeSampleDescription
request_idstringd52ca43b277a4f9292fb8be658bfd33dMã request của Shopee để tra lỗi.
errorstringMã lỗi Shopee; rỗng = thành công.
messagestringMô tả lỗi.
responseobjectKết quả nghiệp vụ.
summaryobject[]Tổng hợp trong kỳ của các đối tượng đã chọn. Tiền tệ USD khi có dữ liệu.
currencystringUSDMã tiền tệ cho các chỉ số tiền; LOCAL hoặc USD.
ordersint6410Số đơn đã đặt, gồm đã và chưa thanh toán, kể cả đơn hủy.
buyersint6410Số người mua duy nhất đã đặt đơn.
likesint6410Tổng lượt nhấn thích.
commentsint6410Tổng bình luận.
sales_grossfloat10Giá trị đơn đã đặt trong livestream, đã và chưa thanh toán, sau khoản giảm giá người bán chịu; gồm đơn hủy.
units_soldint6410Số đơn vị sản phẩm bán từ các đơn đã đặt.
total_viewsint6410Tổng lượt xem.
total_live_durationint6410Tổng thời lượng livestream.
unique_viewersint6410Số người xem duy nhất.
atc_unitsint6410Số lượt nhấn Thêm vào giỏ của các sản phẩm trong giỏ cam.
total_livestreamsint6410Tổng số phiên livestream trong kỳ.
average_live_durationfloat10Thời lượng livestream trung bình.
average_views_durationfloat10Thời gian xem trung bình.
new_followersint6410Số người theo dõi mới từ livestream.
new_buyersint6410Người mua chưa đặt đơn (đã hoặc chưa thanh toán) qua livestream trong 365 ngày trước.
existing_buyersint6410Người mua từng đặt đơn (đã hoặc chưa thanh toán) qua livestream trong 365 ngày trước.
sales_netfloat10Giá trị đơn đã đặt trong livestream, đã và chưa thanh toán, sau khoản giảm giá người bán chịu; loại khoản hoàn tiền của các mục không bị hủy và các mục không hợp lệ.
conversion_ratefloat0.1Số đơn livestream / lượt xem livestream.
detailsobject[]Chi tiết trong kỳ của từng đối tượng. Theo khu vực; gộp từ dữ liệu livestream từng gian hàng.
regionstringSGMã khu vực.
currencystringUSDMã tiền tệ cho các chỉ số tiền; LOCAL hoặc USD.
ordersint6410Số đơn đã đặt, gồm đã và chưa thanh toán, kể cả đơn hủy.
buyersint6410Số người mua duy nhất đã đặt đơn.
likesint6410Tổng lượt nhấn thích.
commentsint6410Tổng bình luận.
sales_grossfloat10Giá trị đơn đã đặt trong livestream, đã và chưa thanh toán, sau khoản giảm giá người bán chịu; gồm đơn hủy.
units_soldint6410Số đơn vị sản phẩm bán từ các đơn đã đặt.
total_viewsint6410Tổng lượt xem.
total_live_durationint6410Tổng thời lượng livestream.
unique_viewersint6410Số người xem duy nhất.
atc_unitsint6410Số lượt nhấn Thêm vào giỏ của các sản phẩm trong giỏ cam.
total_livestreamsint6410Tổng số phiên livestream trong kỳ.
average_live_durationfloat10Thời lượng livestream trung bình.
average_views_durationfloat10Thời gian xem trung bình.
new_followersint6410Số người theo dõi mới từ livestream.
new_buyersint6410Người mua chưa đặt đơn (đã hoặc chưa thanh toán) qua livestream trong 365 ngày trước.
existing_buyersint6410Người mua từng đặt đơn (đã hoặc chưa thanh toán) qua livestream trong 365 ngày trước.
sales_netfloat10Giá trị đơn đã đặt trong livestream, đã và chưa thanh toán, sau khoản giảm giá người bán chịu; loại khoản hoàn tiền của các mục không bị hủy và các mục không hợp lệ.
conversion_ratefloat0.1Số đơn livestream / lượt xem livestream.

Response sample

{
  "request_id": "demo-request",
  "error": "",
  "message": "",
  "response": {
    "summary": [
      {
        "currency": "USD",
        "orders": 10,
        "buyers": 10,
        "likes": 10,
        "comments": 10,
        "sales_gross": 10,
        "units_sold": 10,
        "total_views": 10,
        "total_live_duration": 10,
        "unique_viewers": 10,
        "atc_units": 10,
        "total_livestreams": 10,
        "average_live_duration": 10,
        "average_views_duration": 10,
        "new_followers": 10,
        "new_buyers": 10,
        "existing_buyers": 10,
        "sales_net": 10,
        "conversion_rate": 0.1
      }
    ],
    "details": [
      {
        "region": "SG",
        "currency": "USD",
        "orders": 10,
        "buyers": 10,
        "likes": 10,
        "comments": 10,
        "sales_gross": 10,
        "units_sold": 10,
        "total_views": 10,
        "total_live_duration": 10,
        "unique_viewers": 10,
        "atc_units": 10,
        "total_livestreams": 10,
        "average_live_duration": 10,
        "average_views_duration": 10,
        "new_followers": 10,
        "new_buyers": 10,
        "existing_buyers": 10,
        "sales_net": 10,
        "conversion_rate": 0.1
      }
    ]
  }
}

Shopee error codes (5)

Show
CodeMeaning
error_paramTham số sai / thiếu / sai kiểu — xem `message` để biết tham số nào.
error_permissionGian hàng không có quyền xem dữ liệu này (vd yêu cầu trả / đơn không thuộc gian hàng).
error_authỦy quyền gian hàng cho 360 đã hết hạn hoặc bị thu hồi (360 đã tự làm mới token một lần) — chủ gian hàng kết nối lại Shopee trong Partner.
error_limitChạm hạn mức gọi Shopee trong ngày của kết nối — 360 trả kèm thời điểm thử lại; giảm tần suất gọi.
error_rate_limitGọi quá nhanh — chờ vài giây rồi gọi lại (360 cũng giới hạn theo key: 429 + Retry-After).

Get started

  1. Sign up for Partner
  2. Enable a data type of the Sản phẩm group on the platform page
  3. Create an API key (tick the Shopee channel)
  4. Call it as in the examples above