VI | EN
Nhắn Messenger
Dành cho developer

Inventory histories — API Pancake POS

get /shops/{SHOP_ID}/inventory_histories · gọi qua Quantri360 bằng một API key cho chính tài khoản / tài sản bạn đã kết nối và ủy quyền — 360 lo việc ký request và làm mới phiên đăng nhập bạn đã cấp.

get /shops/{SHOP_ID}/inventory_histories

GET/shops/{SHOP_ID}/inventory_historiesGọi qua 360: GET https://partner.quantri360.com/v1/pancake_pos/shops/{SHOP_ID}/inventory_histories
Sắp mở. API này đã chạy thật qua 360 và đang được chốt giá — bạn có thể đọc tài liệu và chuẩn bị tích hợp trước.
Mô tả API

Lịch sử xuất nhập kho từng dòng: mẫu mã nào, kho nào, tăng / giảm bao nhiêu, do việc gì (thêm vào đơn, nhập Excel, phiếu nhập, chuyển kho…), tồn sau thay đổi, ai làm. Dùng để truy vết chênh lệch tồn và dựng thẻ kho.

  • startDate / endDate là Unix GIÂY (gửi mili giây cũng ra cùng kết quả). Gọi thật: dòng inserted_at 2026-08-31T09:43 lọc khớp khi khoảng là 09:30–10:00 UTC, KHÔNG khớp 09:30–10:00 giờ VN → inserted_at là UTC, cộng 7 giờ ra giờ VN.
  • id có thể là số rất lớn (vd 276701174445076700) — JSON.parse của JavaScript làm tròn mất chữ số cuối; đọc bằng bộ parse giữ số lớn nếu cần dùng id.
  • Có tên, email, SĐT nhân viên trong user.

Request

Địa chỉ

GET https://partner.quantri360.com/v1/pancake_pos/shops/{SHOP_ID}/inventory_histories

Xác thực & gian hàng

TênVị tríKiểuMẫuMô tả
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_idquerystring1234567SHOP_ID đã nối — có thể bỏ khi đường dẫn có /shops/{SHOP_ID}.

Tham số request

TênVị tríKiểuBắt buộcMẫuMô tả
SHOP_IDpathintegerCó1234567Mã cửa hàng đã nối với 360.
pagequeryintCó1Trang, từ 1.
page_sizequeryintCó100Số dòng / trang — gọi thật 1000 vẫn nhận.
warehouse_idquerystringKhông6d1b3245-…Lọc một kho.
variation_ids[]querystring[]Khôngf40a94fe-…Lọc mẫu mã; lặp tham số cho nhiều mã.
startDatequeryintKhông1788109200Từ (Unix giây).
endDatequeryintKhông1788195599Đến (Unix giây).

Phân trang

Tăng page tới total_pages. Mới nhất trước.

Ví dụ request

curl -s "https://partner.quantri360.com/v1/pancake_pos/shops/1234567/inventory_histories?page=1&page_size=100&startDate=1788109200&endDate=1788195599" \
  -H "Authorization: Bearer $KEY"
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.get(
    "https://partner.quantri360.com/v1/pancake_pos/shops/1234567/inventory_histories",
    params={
        "page": 1,
        "page_size": 100,
        "startDate": 1788109200,
        "endDate": 1788195599
    },
    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/pancake_pos/shops/1234567/inventory_histories');
for (const [k, v] of Object.entries({"page":1,"page_size":100,"startDate":1788109200,"endDate":1788195599})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
  method: 'GET',
  headers: { Authorization: `Bearer ${KEY}` },
});
console.log(r.status, await r.json());
PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/pancake_pos/shops/1234567/inventory_histories' . '?' . http_build_query(['page' => 1, 'page_size' => 100, 'startDate' => 1788109200, 'endDate' => 1788195599]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key]);
$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 Pancake POS)

TênKiểuMẫuMô tả
successbooltrue
dataobject[]Dòng biến động.
idint8751077740Mã dòng — CÓ THỂ VƯỢT 2^53 (xem ghi chú).
typestringThêm sản phẩm vào đơn hàng #9700Mô tả việc gây biến động (chữ, có số đơn / phiếu).
table_namestringordersNguồn: `orders` · `purchases` · …
record_idstringMã bản ghi nguồn.
ref_display_idstring9700Số đơn / phiếu hiển thị.
quantityint-1Thay đổi (âm = xuất, dương = nhập).
remain_quantityint7Tồn bán được sau thay đổi.
avg_pricenumber0Giá vốn bình quân.
warehouseobjectid, name, full_address, phone_number.
variationobjectname, fields.
variation_nowobjectMẫu mã hiện tại: id, display_id, barcode, retail_price, product_id…
current_inventoryobject[]Tồn hiện tại theo kho: id, name, remain_quantity, actual_remain_quantity, total_quantity, avg_price.
inserted_atstring2026-08-31T09:43:32.247330Thời điểm — UTC (không có Z).
userobjectNgười thao tác: id, name, email, phone_number.
editor_idstring
note_typeint6
page_number / page_size / total_pages / total_entriesint

Mẫu phản hồi

{
  "success": true,
  "data": [
    {
      "id": 8751077740,
      "type": "Thêm sản phẩm vào đơn hàng #9700",
      "table_name": "orders",
      "record_id": "270229060048132",
      "ref_display_id": "9700",
      "quantity": -1,
      "remain_quantity": 7,
      "avg_price": 0,
      "inserted_at": "2026-08-31T09:43:32.247330",
      "note_type": 6,
      "user": {
        "id": "0744b189-…",
        "name": "Nhân viên B",
        "email": "nhanvienb@example.com"
      },
      "warehouse": {
        "id": "6d1b3245-…",
        "name": "Kho tổng HN"
      },
      "variation": {
        "name": "Đầm xòe phối ren/M",
        "fields": []
      },
      "variation_now": {
        "id": "f40a94fe-…",
        "display_id": "SDPBC2075-M",
        "barcode": "17530000",
        "retail_price": 1189000
      },
      "current_inventory": [
        {
          "id": "6d1b3245-…",
          "name": "Kho tổng HN",
          "remain_quantity": 7,
          "actual_remain_quantity": 8,
          "total_quantity": 8,
          "avg_price": 0
        }
      ]
    }
  ],
  "page_size": 100,
  "total_pages": 93,
  "page_number": 1,
  "total_entries": 9253
}

Bắt đầu dùng

  1. Đăng ký tài khoản Partner
  2. Mở loại dữ liệu thuộc nhóm Kho ở trang nền tảng
  3. Tạo API key (tick kênh Pancake POS)
  4. Gọi theo ví dụ ở trên