Authentication chung: Tất cả API sử dụng Kong dual-auth: Header
Authorization(API key) bắt buộc. HeaderX-Tenant-IDdo Kong inject — nếu test internal không qua Kong thì bỏ header này, backend tự resolve tenantId theo Authorization key. Không dùng JWT (x-access-token) trong luồng này.
/v1/queues/inboundLấy danh sách tất cả queue inbound của tenant. Hỗ trợ phân trang.
Authentication: Header
X-Api-Key(scope:queue). Kong dual-auth: ưu tiênX-Tenant-IDheader, fallback query DB theo Authorization key.
Base URL: Dev:
https://xapi-dev.alohub.vn| Prod:https://xapi.alohub.vn
Tham số | Vị trí | Bắt buộc | Kiểu | Mô tả | Ví dụ |
|---|---|---|---|---|---|
| query | Không |
| Trang, bắt đầu từ 0 (default: 0) | 0 |
| query | Không |
| Số record/trang (default: 20) | 20 |
curl -X GET "https://xapi.alohub.vn/v1/queues/inbound" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310"
# Phân trang
curl -X GET "https://xapi.alohub.vn/v1/queues/inbound?page=0&size=10" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310"const axios = require('axios');
const response = await axios.get(
'{{host}}/api/v1/queues/inbound?page=0&size=20',
{ headers: { 'Authorization': '{{api-key}}', 'X-Tenant-ID': '{{tenant-id}}', 'Content-Type': 'application/json' } }
);
console.log(response.data);import requests
params = {"page": "0", "size": "20"}
headers = {"Authorization": "{{api-key}}", "X-Tenant-ID": "{{tenant-id}}", "Content-Type": "application/json"}
response = requests.get(
'{{host}}/api/v1/queues/inbound',
headers=headers, params=params
)
print(response.json())
{
"success": "1",
"error_code": "SUCCESS",
"totalRecord": 3,
"data": [
{
"callinId": 1001226,
"callinName": "test",
"strategy": 1,
"musicinQueue": "waiting.wav",
"timeWait": "120",
"agentSelector": null,
"nguongRanhRoi": null,
"callinNumber": null
}
]
}
Field | Kiểu | Mô tả | |
|---|---|---|---|
|
| "1" = thành công | |
|
| Tổng số queue | |
|
| ID queue — dùng làm {id} trong GET detail và PUT update | |
|
| Tên queue | |
|
| null | 1=thường, 2=VIP, 3=blacklist, 4=divert, 99=tạm khoá |
|
| null | Tên file nhạc chờ (music on hold) |
|
| null | Thời gian chờ tối đa (giây) |
|
| null | Thuật toán chọn agent |
|
| null | Announce position: 0=tắt, 1=bật |
|
| null | Số điện thoại của queue |
HTTP | error_code | Mô tả | FE xử lý |
|---|---|---|---|
401 | UNAUTHORIZED | Thiếu hoặc sai API key | Redirect nhập lại key |
403 | INSUFFICIENT_SCOPE | Key không có scope | Hiện thông báo |
404 | NOT_FOUND | Không tìm thấy | Hiện thông báo |
429 | RATE_LIMIT_EXCEEDED | Vượt giới hạn request | Retry sau Retry-After giây |
500 | FAIL | Lỗi hệ thống | Toast lỗi chung |
Header | Mô tả |
|---|---|
| Giới hạn tenant/10s |
| Còn lại tenant/10s |
| Giới hạn route/10s |
| Còn lại route/10s |
| Giây cần chờ khi bị 429 |
/v1/queues/inbound/{id}Lấy chi tiết 1 queue inbound. Backend kiểm tra ownership: queue phải thuộc tenant của auth header.
Authentication: Header
X-Api-Key(scope:queue). Kong dual-auth: ưu tiênX-Tenant-IDheader, fallback query DB theo Authorization key.
Base URL: Dev:
https://xapi-dev.alohub.vn| Prod:https://xapi.alohub.vn
Tham số | Vị trí | Bắt buộc | Kiểu | Mô tả | Ví dụ |
|---|---|---|---|---|---|
| path | Có |
| callinId (lấy từ GET /v1/queues/inbound) | 1001226 |
curl -X GET "https://xapi.alohub.vn/v1/queues/inbound/1001226" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310"const axios = require('axios');
const response = await axios.get(
'{{host}}/api/v1/queues/inbound/{{id}}',
{ headers: { 'Authorization': '{{api-key}}', 'X-Tenant-ID': '{{tenant-id}}', 'Content-Type': 'application/json' } }
);
console.log(response.data);import requests
headers = {"Authorization": "{{api-key}}", "X-Tenant-ID": "{{tenant-id}}", "Content-Type": "application/json"}
response = requests.get(
'{{host}}/api/v1/queues/inbound/{{id}}',
headers=headers
)
print(response.json())
{
"callinId": 1001226,
"callinName": "test",
"strategy": 1,
"musicinQueue": "waiting.wav",
"timeWait": "120",
"agentSelector": null,
"nguongRanhRoi": null,
"callinNumber": null
}
Field | Kiểu | Mô tả | |
|---|---|---|---|
|
| ID queue | |
|
| Tên queue | |
|
| null | 1=thường, 2=VIP, 3=blacklist, 4=divert, 99=tạm khoá |
|
| null | Tên file nhạc chờ |
|
| null | Thời gian chờ tối đa (giây) |
|
| null | Thuật toán chọn agent |
|
| null | Announce position: 0=tắt, 1=bật |
|
| null | Số điện thoại của queue |
HTTP | error_code | Mô tả | FE xử lý |
|---|---|---|---|
401 | UNAUTHORIZED | Thiếu hoặc sai API key | Redirect nhập lại key |
403 | INSUFFICIENT_SCOPE | Key không có scope | Hiện thông báo |
404 | NOT_FOUND | Không tìm thấy | Hiện thông báo |
429 | RATE_LIMIT_EXCEEDED | Vượt giới hạn request | Retry sau Retry-After giây |
500 | FAIL | Lỗi hệ thống | Toast lỗi chung |
Header | Mô tả |
|---|---|
| Giới hạn tenant/10s |
| Còn lại tenant/10s |
| Giới hạn route/10s |
| Còn lại route/10s |
| Giây cần chờ khi bị 429 |
/v1/queues/inbound/{id}Cập nhật cấu hình queue inbound. Tất cả field optional — cần ít nhất 1 field. strategy phải là số nguyên trong tập {1,2,3,4,99}.
Authentication: Header
X-Api-Key(scope:queue). Kong dual-auth: ưu tiênX-Tenant-IDheader, fallback query DB theo Authorization key.
Base URL: Dev:
https://xapi-dev.alohub.vn| Prod:https://xapi.alohub.vn
Tham số | Vị trí | Bắt buộc | Kiểu | Mô tả | Ví dụ |
|---|---|---|---|---|---|
| path | Có |
| callinId | 1001226 |
{
"moh_file_id": "waiting.wav",
"max_wait_sec": "180",
"strategy": 1,
"announce_position": "1"
}
Field | Bắt buộc | Mô tả |
|---|---|---|
| Không | Tên file nhạc chờ |
| Không | Thời gian chờ tối đa (string số, đơn vị giây) |
| Không | Loại quản lý: 1/2/3/4/99 — phải là số nguyên, dùng dropdown |
| Không | "0" = tắt thông báo vị trí, "1" = bật |
curl -X PUT "https://xapi.alohub.vn/v1/queues/inbound/1001226" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310" \
-H "Content-Type: application/json" \
-d '{"strategy":1}'
# Update nhiều field
curl -X PUT "https://xapi.alohub.vn/v1/queues/inbound/1001226" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310" \
-H "Content-Type: application/json" \
-d '{"moh_file_id":"waiting.wav","max_wait_sec":"180","strategy":1}'const axios = require('axios');
const response = await axios.put(
'{{host}}/api/v1/queues/inbound/{{id}}',
{
"moh_file_id": "waiting.wav",
"max_wait_sec": "180",
"strategy": 1,
"announce_position": "1"
},
{ headers: { 'Authorization': '{{api-key}}', 'X-Tenant-ID': '{{tenant-id}}', 'Content-Type': 'application/json' } }
);
console.log(response.data);import requests
headers = {"Authorization": "{{api-key}}", "X-Tenant-ID": "{{tenant-id}}", "Content-Type": "application/json"}
payload = {
"moh_file_id": "waiting.wav",
"max_wait_sec": "180",
"strategy": 1,
"announce_position": "1"
}
response = requests.put(
'{{host}}/api/v1/queues/inbound/{{id}}',
json=payload,
headers=headers
)
print(response.json())
{
"success": "1",
"error_code": "SUCCESS",
"error_message": "Inbound queue updated successfully"
}
Field | Kiểu | Mô tả |
|---|---|---|
|
| "1" = thành công |
|
| SUCCESS khi cập nhật thành công |
|
| Mô tả kết quả |
HTTP | error_code | Mô tả | FE xử lý |
|---|---|---|---|
401 | UNAUTHORIZED | Thiếu hoặc sai API key | Redirect nhập lại key |
403 | INSUFFICIENT_SCOPE | Key không có scope | Hiện thông báo |
400 | INVALID_INPUT | Sai input | Hiện lỗi cụ thể |
404 | NOT_FOUND | Không tìm thấy | Hiện thông báo |
429 | RATE_LIMIT_EXCEEDED | Vượt giới hạn request | Retry sau Retry-After giây |
500 | FAIL | Lỗi hệ thống | Toast lỗi chung |
Header | Mô tả |
|---|---|
| Giới hạn tenant/10s |
| Còn lại tenant/10s |
| Giới hạn route/10s |
| Còn lại route/10s |
| Giây cần chờ khi bị 429 |