General Authentication:All APIs use Kong dual-auth: Header
Authorization(API key) is required. HeaderX-Tenant-IDinjected by Kong — if testing internal without going through Kong, omit this header, backend will resolve tenantId based on Authorization key. Do not use JWT (x-access-token) in this flow.
/v1/agentsRetrieve the list of all agents for the tenant. Supports filtering by status, queue, and pagination.
Authentication:Header
X-Api-Key(scope:agent). Kong dual-auth: prioritizesX-Tenant-IDheader, fallback to query DB based on Authorization key.
Base URL:Dev:
https://xapi-dev.alohub.vn| Prod:https://xapi.alohub.vn
Parameters | Location | Required | Type | Description | Example |
|---|---|---|---|---|---|
| query | No |
| Filter by specific tenantId (default from auth) | 20260310 |
| query | No |
| 1 = active, 0 = inactive | 1 |
| query | No |
| Filter agents belonging to this callin queue | 1001226 |
| query | No |
| Page, starting from 0 (default: 0) | 0 |
| query | No |
| Number of records per page (default: 20) | 20 |
curl -X GET "https://xapi.alohub.vn/v1/agents" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310"
# Filter active + queue
curl -X GET "https://xapi.alohub.vn/v1/agents?status=1&queue_id=1001226&page=0&size=20" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310"const axios = require('axios');
const response = await axios.get(
'{{host}}/api/v1/agents?team_id=20260310&status=1&queue_id=1001226&page=0&size=20',
{ headers: { 'Authorization': '{{api-key}}', 'X-Tenant-ID': '{{tenant-id}}', 'Content-Type': 'application/json' } }
);
console.log(response.data);import requests
params = {"team_id": "20260310", "status": "1", "queue_id": "1001226", "page": "0", "size": "20"}
headers = {"Authorization": "{{api-key}}", "X-Tenant-ID": "{{tenant-id}}", "Content-Type": "application/json"}
response = requests.get(
'{{host}}/api/v1/agents',
headers=headers, params=params
)
print(response.json()){
"success": "1",
"error_code": "SUCCESS",
"error_message": "SUCCESS",
"totalRecord": 413,
"data": [
{
"tenantId": 20260310,
"tenantName": "AloHub",
"agentId": "082018",
"status": 1,
"userName": "AloHub.admin",
"queueCallin": "1001226-test",
"queueCallout": 13876,
"queueCalloutName": "AloHub",
"queueCallinId": "1001226",
"isFollowMe": 1,
"priority": "1",
"systemStatus": "AVAILABLE",
"userStatus": "LOGOUT"
}
]
}Field | Type | Description | |
|---|---|---|---|
|
| "1" = success, "0" = error | |
|
| Error code | |
|
| Total number of agents | |
|
| Tenant ID | |
|
| Tenant name | |
|
| Extension number — used as {id} in PUT /queues and PUT /recording | |
|
| 1 = active, 0 = inactive | |
|
| null | Username |
|
| null | "-" — callin queue currently attached |
|
| null | Callin queue ID |
|
| null | Callout queue ID |
|
| null | Callout queue name |
|
| null | 1 = enable follow-me |
|
| null | Priority in queue |
|
| null | AVAILABLE / NOT AVAILABLE |
|
| null | AVAILABLE / LOGOUT |
HTTP | error_code | Description | FE handling |
|---|---|---|---|
401 | UNAUTHORIZED | Missing or incorrect API key | Redirect to re-enter key |
403 | INSUFFICIENT_SCOPE | Key does not have scope | Show message |
404 | NOT_FOUND | Not found | Show message |
429 | RATE_LIMIT_EXCEEDED | Exceeded request limit | Retry after Retry-After seconds |
500 | FAIL | System error | General error toast |
Header | Description |
|---|---|
| Limit tenant/10s |
| Remaining tenant/10s |
| Limit route/10s |
| Remaining route/10s |
| Seconds to wait when receiving 429 |
/v1/agents/{id}/queuesAssign agent to callin or callout queue. type=callin: REPLACE ENTIRE old queue list — to add a queue, need to send both old + new list.
Authentication:Header
X-Api-Key(scope:agent). Kong dual-auth: prioritizesX-Tenant-IDheader, fallback to query DB based on Authorization key.
Base URL:Dev:
https://xapi-dev.alohub.vn| Prod:https://xapi.alohub.vn
Parameters | Location | Required | Type | Description | Example |
|---|---|---|---|---|---|
| path | Yes |
| agentId = extension number (obtained from GET /v1/agents) | 082018 |
| query | No |
| "callin" (default) or "callout" | callin |
{
"queue_ids": [
1001226,
1000886
],
"priority": 1
}Field | Required | Description |
|---|---|---|
| Yes | Array of queue IDs. Must not be empty. |
| No | Priority in callin queue. Only applies type=callin. |
curl -X PUT "https://xapi.alohub.vn/v1/agents/082018/queues?type=callin" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310" \
-H "Content-Type: application/json" \
-d '{"queue_ids":[1001226,1000886],"priority":1}'
# Gán callout queue
curl -X PUT "https://xapi.alohub.vn/v1/agents/082018/queues?type=callout" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310" \
-H "Content-Type: application/json" \
-d '{"queue_ids":[13876]}'const axios = require('axios');
const response = await axios.put(
'{{host}}/api/v1/agents/{{id}}/queues?type=callin',
{
"queue_ids": [
1001226,
1000886
],
"priority": 1
},
{ headers: { 'Authorization': '{{api-key}}', 'X-Tenant-ID': '{{tenant-id}}', 'Content-Type': 'application/json' } }
);
console.log(response.data);import requests
params = {"type": "callin"}
headers = {"Authorization": "{{api-key}}", "X-Tenant-ID": "{{tenant-id}}", "Content-Type": "application/json"}
payload = {
"queue_ids": [
1001226,
1000886
],
"priority": 1
}
response = requests.put(
'{{host}}/api/v1/agents/{{id}}/queues',
json=payload,
headers=headers, params=params
)
print(response.json()){
"success": "1",
"error_code": "SUCCESS",
"error_message": "Agent queues updated successfully"
}Field | Type | Description |
|---|---|---|
|
| "1" = success |
|
| SUCCESS when updated successfully |
|
| Result description |
HTTP | error_code | Description | FE handling |
|---|---|---|---|
401 | UNAUTHORIZED | Missing or incorrect API key | Redirect to re-enter key |
403 | INSUFFICIENT_SCOPE | Key does not have scope | Show message |
400 | INVALID_INPUT | Incorrect input | Show specific error |
404 | NOT_FOUND | Not found | Show message |
429 | RATE_LIMIT_EXCEEDED | Exceeded request limit | Retry after Retry-After seconds |
500 | FAIL | System error | General error toast |
Header | Description |
|---|---|
| Limit tenant/10s |
| Remaining tenant/10s |
| Limit route/10s |
| Remaining route/10s |
| Seconds to wait when receiving 429 |
/v1/agents/{id}/recordingEnable or disable recording feature for agent. Requires DBA to run migration_add_is_record.sql first.
Authentication:Header
X-Api-Key(scope:agent). Kong dual-auth: prioritizesX-Tenant-IDheader, fallback to query DB based on Authorization key.
Base URL:Dev:
https://xapi-dev.alohub.vn| Prod:https://xapi.alohub.vn
Parameters | Location | Required | Type | Description | Example |
|---|---|---|---|---|---|
| path | Yes |
| agentId = extension number | 082018 |
{
"enabled": true
}Field | Required | Description |
|---|---|---|
| Yes | true = enable recording, false = disable recording |
curl -X PUT "https://xapi.alohub.vn/v1/agents/082018/recording" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310" \
-H "Content-Type: application/json" \
-d '{"enabled":true}'
# Tắt ghi âm
curl -X PUT "https://xapi.alohub.vn/v1/agents/082018/recording" \
-H "X-Api-Key: sk_live_xxx" \
-H "X-Tenant-ID: 20260310" \
-H "Content-Type: application/json" \
-d '{"enabled":false}'const axios = require('axios');
const response = await axios.put(
'{{host}}/api/v1/agents/{{id}}/recording',
{
"enabled": true
},
{ 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 = {
"enabled": true
}
response = requests.put(
'{{host}}/api/v1/agents/{{id}}/recording',
json=payload,
headers=headers
)
print(response.json()){
"success": "1",
"error_code": "SUCCESS",
"error_message": "Recording enabled for agent 082018"
}Field | Type | Description |
|---|---|---|
|
| "1" = success |
|
| SUCCESS when updated successfully |
|
| "Recording enabled/disabled for agent {id}" |
HTTP | error_code | Description | FE handling |
|---|---|---|---|
401 | UNAUTHORIZED | Missing or incorrect API key | Redirect to re-enter key |
403 | INSUFFICIENT_SCOPE | Key does not have scope | Show message |
400 | INVALID_INPUT | Incorrect input | Show specific error |
404 | NOT_FOUND | Not found | Show message |
429 | RATE_LIMIT_EXCEEDED | Exceeded request limit | Retry after Retry-After seconds |
500 | FAIL | System error | General error toast |
Header | Description |
|---|---|
| Limit tenant/10s |
| Remaining tenant/10s |
| Limit route/10s |
| Remaining route/10s |
| Seconds to wait when receiving 429 |