EasyCall API Docs
EasyCall системийн Call API болон SMS API холболтын гарын авлага. Endpoint бүр дээр request, parameter, response example болон cURL, PHP, Python, JavaScript жишээ кодыг тухайн endpoint-ийн доор оруулсан.
API Base URL
Бүх жишээ код дээр дараах үндсэн домэйныг ашиглана.
https://api.easycall.mnНэвтрэх эрх
Call API нь байгууллагад холбогдсон API token ашиглана.
SMS API нь байгууллагад холбосон api_key-ийг JSON body дотор api_key утгаар дамжуулна.
Authorization: Bearer YOUR_API_TOKEN{
"api_key": "YOUR_SMS_API_KEY"
}Нийтлэг алдааны кодууд
| HTTP Code | Тайлбар |
|---|---|
400 | Parameter дутуу эсвэл буруу format-тай. |
401 | API token эсвэл api_key буруу. |
403 | Тухайн resource-д хандах эрхгүй. |
404 | Дуудлага, бичлэг эсвэл resource олдсонгүй. |
500 | Серверийн дотоод алдаа. |
Filters & Pagination
Call API endpoint-үүд дээр дараах нийтлэг query parameter-үүд ашиглагдана.
| Parameter | Type | Required | Тайлбар |
|---|---|---|---|
start_date | date | Yes | Эхлэх огноо. Format: YYYY-MM-DD |
end_date | date | Yes | Дуусах огноо. Format: YYYY-MM-DD |
sip_number | string | No | Token-д зөвшөөрөгдсөн SIP дотроос нэгийг сонгоно. |
src | string | No | Caller дугаараар хайх. |
dst | string | No | Destination дугаараар хайх. |
disposition | string | No | ANSWERED, NO ANSWER, BUSY, FAILED, CONGESTION. |
page | integer | No | Default: 1. |
limit | integer | No | Default: 100. Max: 1000. |
/api_v1/call/statsCall Statistics
Дуудлагын тоон үзүүлэлт, хариулсан хувь, ярианы хугацаа, disposition болон цагийн задаргаа буцаана.
| Parameter / Field | Type | Required | Тайлбар |
|---|---|---|---|
start_date | date | Yes | Эхлэх огноо. |
end_date | date | Yes | Дуусах огноо. |
direction | string | No | all, inbound, outbound. Default: all. |
{
"success": true,
"data": {
"total_calls": 1520,
"answered": 1203,
"failed": 317,
"answer_rate": 79.14,
"total_talk_time": "58:23:17",
"avg_talk_time_seconds": 174.7,
"avg_wait_time_seconds": 8.2
}
}Example code
curl -X GET "{{base_url}}/api_v1/call/stats?start_date=2026-06-01&end_date=2026-06-10&direction=all" \
-H "Authorization: Bearer YOUR_API_TOKEN"<?php
$token = 'YOUR_API_TOKEN';
$url = '{{base_url}}/api_v1/call/stats?' . http_build_query([
'start_date' => '2026-06-01',
'end_date' => '2026-06-10',
'direction' => 'all'
]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token]
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));import requests
token = "YOUR_API_TOKEN"
response = requests.get(
"{{base_url}}/api_v1/call/stats",
params={
"start_date": "2026-06-01",
"end_date": "2026-06-10",
"direction": "all"
},
headers={"Authorization": f"Bearer {token}"}
)
print(response.json())const params = new URLSearchParams({
start_date: '2026-06-01',
end_date: '2026-06-10',
direction: 'all'
});
const response = await fetch(`{{base_url}}/api_v1/call/stats?${params}`, {
headers: { Authorization: 'Bearer YOUR_API_TOKEN' }
});
const data = await response.json();
console.log(data);/api_v1/call/inboundInbound Calls
Ирсэн дуудлагын жагсаалт авна.
| Parameter / Field | Type | Required | Тайлбар |
|---|---|---|---|
start_date | date | Yes | Эхлэх огноо. |
end_date | date | Yes | Дуусах огноо. |
page | integer | No | Default: 1. |
limit | integer | No | Default: 100. |
{
"success": true,
"meta": { "page": 1, "limit": 100, "count": 1 },
"data": [
{
"id": 41265026,
"start": "2026-06-01 09:15:00",
"src": "99112233",
"dst": "77327733",
"duration": 45,
"duration_format": "00:45",
"billsec": 30,
"billsec_format": "00:30",
"disposition": "ANSWERED",
"session": "1748912345.123",
"recordings": []
}
]
}Example code
curl -X GET "{{base_url}}/api_v1/call/inbound?start_date=2026-06-01&end_date=2026-06-10&page=1&limit=100" \
-H "Authorization: Bearer YOUR_API_TOKEN"<?php
$token = 'YOUR_API_TOKEN';
$url = '{{base_url}}/api_v1/call/inbound?' . http_build_query([
'start_date' => '2026-06-01',
'end_date' => '2026-06-10',
'page' => 1,
'limit' => 100
]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token]
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));import requests
token = "YOUR_API_TOKEN"
response = requests.get(
"{{base_url}}/api_v1/call/inbound",
params={
"start_date": "2026-06-01",
"end_date": "2026-06-10",
"page": 1,
"limit": 100
},
headers={"Authorization": f"Bearer {token}"}
)
print(response.json())const params = new URLSearchParams({
start_date: '2026-06-01',
end_date: '2026-06-10',
page: '1',
limit: '100'
});
const response = await fetch(`{{base_url}}/api_v1/call/inbound?${params}`, {
headers: { Authorization: 'Bearer YOUR_API_TOKEN' }
});
const data = await response.json();
console.log(data);/api_v1/call/outboundOutbound Calls
Гарсан дуудлагын жагсаалт авна.
| Parameter / Field | Type | Required | Тайлбар |
|---|---|---|---|
start_date | date | Yes | Эхлэх огноо. |
end_date | date | Yes | Дуусах огноо. |
page | integer | No | Default: 1. |
limit | integer | No | Default: 100. |
{
"success": true,
"meta": { "page": 1, "limit": 100, "count": 1 },
"data": [
{
"id": 41265088,
"start": "2026-06-01 10:20:00",
"src": "1501",
"dst": "99112233",
"duration": 65,
"billsec": 51,
"disposition": "ANSWERED",
"session": "1748912999.200"
}
]
}Example code
curl -X GET "{{base_url}}/api_v1/call/outbound?start_date=2026-06-01&end_date=2026-06-10&page=1&limit=100" \
-H "Authorization: Bearer YOUR_API_TOKEN"<?php
$token = 'YOUR_API_TOKEN';
$url = '{{base_url}}/api_v1/call/outbound?' . http_build_query([
'start_date' => '2026-06-01',
'end_date' => '2026-06-10',
'page' => 1,
'limit' => 100
]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token]
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));import requests
token = "YOUR_API_TOKEN"
response = requests.get(
"{{base_url}}/api_v1/call/outbound",
params={
"start_date": "2026-06-01",
"end_date": "2026-06-10",
"page": 1,
"limit": 100
},
headers={"Authorization": f"Bearer {token}"}
)
print(response.json())const params = new URLSearchParams({
start_date: '2026-06-01',
end_date: '2026-06-10',
page: '1',
limit: '100'
});
const response = await fetch(`{{base_url}}/api_v1/call/outbound?${params}`, {
headers: { Authorization: 'Bearer YOUR_API_TOKEN' }
});
const data = await response.json();
console.log(data);/api_v1/call/detailsCall Details
Нэг session-д хамаарах бүх CDR мөрүүдийг авна.
| Parameter / Field | Type | Required | Тайлбар |
|---|---|---|---|
session | string | Yes | Inbound/outbound response-оос ирсэн session. |
start | date | Yes | Дуудлага эхэлсэн огноо. |
{
"success": true,
"data": [
{
"id": 41265026,
"start": "2026-06-01 09:15:00",
"src": "99112233",
"dst": "77327733",
"duration_format": "00:45",
"billsec_format": "00:30",
"disposition": "ANSWERED"
}
]
}Example code
curl -X GET "{{base_url}}/api_v1/call/details?session=1748912345.123&start=2026-06-01" \
-H "Authorization: Bearer YOUR_API_TOKEN"<?php
$token = 'YOUR_API_TOKEN';
$url = '{{base_url}}/api_v1/call/details?' . http_build_query([
'session' => '1748912345.123',
'start' => '2026-06-01'
]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token]
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));import requests
token = "YOUR_API_TOKEN"
response = requests.get(
"{{base_url}}/api_v1/call/details",
params={"session": "1748912345.123", "start": "2026-06-01"},
headers={"Authorization": f"Bearer {token}"}
)
print(response.json())const params = new URLSearchParams({
session: '1748912345.123',
start: '2026-06-01'
});
const response = await fetch(`{{base_url}}/api_v1/call/details?${params}`, {
headers: { Authorization: 'Bearer YOUR_API_TOKEN' }
});
const data = await response.json();
console.log(data);Recording download flow
Ярианы бичлэгийг storage URL харуулахгүйгээр нэг удаагийн download token ашиглан татна.
download_url буцаана./api_v1/call/download endpoint-оор файл татна./api_v1/call/recording-tokenCreate recording download token
Ярианы бичлэг татах нэг удаагийн token үүсгэнэ.
| Parameter / Field | Type | Required | Тайлбар |
|---|---|---|---|
call_id | integer | Yes | Дуудлагын ID. |
start | date | Yes | Дуудлага эхэлсэн огноо. |
file | string | Yes | recordings дотор ирсэн файлын нэр. |
{
"success": true,
"data": {
"download_url": "{{base_url}}/api_v1/call/download?token=ONE_TIME_TOKEN",
"expires_in_seconds": 300,
"one_time": true
}
}Example code
curl -X GET "{{base_url}}/api_v1/call/recording-token?call_id=41265026&start=2026-06-01&file=2026-06%2Fauto-1780480309-99149780-1099.wav" \
-H "Authorization: Bearer YOUR_API_TOKEN"<?php
$token = 'YOUR_API_TOKEN';
$url = '{{base_url}}/api_v1/call/recording-token?' . http_build_query([
'call_id' => 41265026,
'start' => '2026-06-01',
'file' => '2026-06/auto-1780480309-99149780-1099.wav'
]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token]
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data);import requests
token = "YOUR_API_TOKEN"
response = requests.get(
"{{base_url}}/api_v1/call/recording-token",
params={
"call_id": 41265026,
"start": "2026-06-01",
"file": "2026-06/auto-1780480309-99149780-1099.wav"
},
headers={"Authorization": f"Bearer {token}"}
)
print(response.json())const params = new URLSearchParams({
call_id: '41265026',
start: '2026-06-01',
file: '2026-06/auto-1780480309-99149780-1099.wav'
});
const response = await fetch(`{{base_url}}/api_v1/call/recording-token?${params}`, {
headers: { Authorization: 'Bearer YOUR_API_TOKEN' }
});
const data = await response.json();
console.log(data);/api_v1/call/downloadDownload recording
Нэг удаагийн token ашиглан бичлэгийн файлыг татна. Энэ endpoint нь JSON биш, аудио файлыг attachment байдлаар буцаана.
| Parameter / Field | Type | Required | Тайлбар |
|---|---|---|---|
token | string | Yes | recording-token endpoint-оос авсан нэг удаагийн token. |
Binary audio file responseExample code
curl -L -o recording.wav "{{base_url}}/api_v1/call/download?token=ONE_TIME_TOKEN"<?php
$downloadUrl = '{{base_url}}/api_v1/call/download?token=ONE_TIME_TOKEN';
$ch = curl_init($downloadUrl);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true
]);
$fileContent = curl_exec($ch);
curl_close($ch);
file_put_contents('recording.wav', $fileContent);import requests
url = "{{base_url}}/api_v1/call/download?token=ONE_TIME_TOKEN"
response = requests.get(url)
response.raise_for_status()
with open("recording.wav", "wb") as f:
f.write(response.content)const response = await fetch('{{base_url}}/api_v1/call/download?token=ONE_TIME_TOKEN');
const blob = await response.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'recording.wav';
a.click();
URL.revokeObjectURL(url);SMS API Overview
SMS API нь JSON body ашиглан ажиллана. api_key заавал дамжуулна.
/api_v1/send_sms_apiSend SMS
Нэг утасны дугаар руу SMS илгээнэ.
| Parameter / Field | Type | Required | Тайлбар |
|---|---|---|---|
api_key | string | Yes | SMS API key. |
phone | string | Yes | Илгээх утасны дугаар. |
message | string | Yes | Илгээх мессеж. |
{
"success": true,
"message": "SMS queued successfully"
}Example code
curl -X POST "{{base_url}}/api_v1/send_sms_api" \
-H "Content-Type: application/json" \
-d '{
"api_key": "YOUR_SMS_API_KEY",
"phone": "99101261",
"message": "Hello EasyCall"
}' <?php
$payload = [
'api_key' => 'YOUR_SMS_API_KEY',
'phone' => '99101261',
'message' => 'Hello EasyCall'
];
$ch = curl_init('{{base_url}}/api_v1/send_sms_api');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload)
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));import requests
response = requests.post(
"{{base_url}}/api_v1/send_sms_api",
json={
"api_key": "YOUR_SMS_API_KEY",
"phone": "99101261",
"message": "Hello EasyCall"
}
)
print(response.json())const response = await fetch('{{base_url}}/api_v1/send_sms_api', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_key: 'YOUR_SMS_API_KEY',
phone: '99101261',
message: 'Hello EasyCall'
})
});
const data = await response.json();
console.log(data);/api_v1/check_sms_balance_apiCheck SMS Balance
SMS үлдэгдэл шалгана.
| Parameter / Field | Type | Required | Тайлбар |
|---|---|---|---|
api_key | string | Yes | SMS API key. |
{
"success": true,
"balance": 12500
}Example code
curl -X POST "{{base_url}}/api_v1/check_sms_balance_api" \
-H "Content-Type: application/json" \
-d '{
"api_key": "YOUR_SMS_API_KEY"
}' <?php
$payload = ['api_key' => 'YOUR_SMS_API_KEY'];
$ch = curl_init('{{base_url}}/api_v1/check_sms_balance_api');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload)
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));import requests
response = requests.post(
"{{base_url}}/api_v1/check_sms_balance_api",
json={"api_key": "YOUR_SMS_API_KEY"}
)
print(response.json())const response = await fetch('{{base_url}}/api_v1/check_sms_balance_api', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ api_key: 'YOUR_SMS_API_KEY' })
});
const data = await response.json();
console.log(data);/api_v1/send_broadcast_apiSend Broadcast
Олон дугаар руу ижил SMS илгээнэ.
| Parameter / Field | Type | Required | Тайлбар |
|---|---|---|---|
api_key | string | Yes | SMS API key. |
phones | array | Yes | Утасны дугааруудын array. |
message | string | Yes | Илгээх мессеж. |
{
"success": true,
"message": "Broadcast SMS queued successfully",
"total": 3
}Example code
curl -X POST "{{base_url}}/api_v1/send_broadcast_api" \
-H "Content-Type: application/json" \
-d '{
"api_key": "YOUR_SMS_API_KEY",
"phones": ["+97699101261", "97688808075", "99101261"],
"message": "Hello EasyCall"
}' <?php
$payload = [
'api_key' => 'YOUR_SMS_API_KEY',
'phones' => ['+97699101261', '97688808075', '99101261'],
'message' => 'Hello EasyCall'
];
$ch = curl_init('{{base_url}}/api_v1/send_broadcast_api');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload)
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));import requests
response = requests.post(
"{{base_url}}/api_v1/send_broadcast_api",
json={
"api_key": "YOUR_SMS_API_KEY",
"phones": ["+97699101261", "97688808075", "99101261"],
"message": "Hello EasyCall"
}
)
print(response.json())const response = await fetch('{{base_url}}/api_v1/send_broadcast_api', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_key: 'YOUR_SMS_API_KEY',
phones: ['+97699101261', '97688808075', '99101261'],
message: 'Hello EasyCall'
})
});
const data = await response.json();
console.log(data);Changelog
| Date | Update |
|---|---|
| 2026-06-11 | Call API болон SMS API documentation, endpoint бүрийн cURL/PHP/Python/JavaScript example code нэмэв. |