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

Hạn mức gửi ZNS hằng ngày / tin truyền thông còn lại — API Zalo OA

Lấy thông tin hạn mức ZNS · 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.

Lấy thông tin hạn mức ZNS

GET/zns/message/quotaGọi qua 360: GET https://partner.quantri360.com/v1/zalo/zns/message/quota
Mô tả API

Hạn mức gửi ZNS (tin qua số điện thoại) của OA: số tin được gửi mỗi ngày và còn lại hôm nay, hạn mức tin hậu mãi (khuyến mại) theo tháng. Kiểm trước khi gửi hàng loạt.

  • Hạn mức tính theo ngày giờ VN; remainingQuota = 0 thì gửi tin sẽ bị từ chối tới ngày sau.
  • Không có tham số.

Request

Địa chỉ

GET https://partner.quantri360.com/v1/zalo/zns/message/quota

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_idquerystring1173478676788457425OA_ID của Zalo OA brand đã nối (GET /v1/platforms). Mỗi brand một OA — có thể bỏ.
dataquerystring (JSON){"offset":0,"count":10}Nhiều API GET của Zalo nhận tham số gói trong data là chuỗi JSON — gửi nguyên như tài liệu Zalo.

Tham số request

Không có tham số riêng (ngoài tham số chung).

Ví dụ request

curl -s "https://partner.quantri360.com/v1/zalo/zns/message/quota" \
  -H "Authorization: Bearer $KEY"
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.get(
    "https://partner.quantri360.com/v1/zalo/zns/message/quota",
    params={},
    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/zalo/zns/message/quota');
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: '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/zalo/zns/message/quota' . '?' . http_build_query([]);
$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 Zalo OA)

TênKiểuMẫuMô tả
errorint00 = thành công.
messagestringsuccess
dataobject
dailyQuotaint5000Số tin ZNS được gửi trong ngày (Zalo tự điều chỉnh theo chất lượng gửi).
remainingQuotaint4988Còn lại hôm nay.
monthlyPromotionQuotaint0Tin hậu mãi được gửi trong tháng.
remainingMonthlyPromotionQuotaint0Tin hậu mãi còn lại trong tháng.
estimatedNextMonthPromotionQuotaint0Hạn mức hậu mãi dự kiến tháng sau.
dailyQuotaPromotionint | null0Cũ — có thể trả null.
remainingQuotaPromotionint | null0Cũ — có thể trả null.

Mẫu phản hồi

{
  "data": {
    "remainingMonthlyPromotionQuota": 0,
    "monthlyPromotionQuota": 0,
    "estimatedNextMonthPromotionQuota": 0,
    "remainingQuotaPromotion": 0,
    "remainingQuota": 4988,
    "dailyQuotaPromotion": 0,
    "dailyQuota": 5000
  },
  "error": 0,
  "message": "success"
}

Bắt đầu dùng

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