REST · JSON · Bearer token
Hello PBX developer API
Start calls, send voice OTP, read call history and look up contacts from your own software. Everything the panel does, available over HTTPS.
Last updated
Getting started
-
Step 1
Check your plan
The API needs a plan with Developer API Access. Voice OTP and auto calls need Auto Call API & Voice OTP.
-
Step 2
Create a token
In your panel open API Keys, name the token and choose what it may do.
-
Step 3
Call /api/v1/ping
Send the token in the Authorization header. A “pong” reply means you are connected.
Authentication
Every request carries a personal API token as a Bearer token. Tokens expire after 90 days and are limited to the abilities you pick when creating them (for example otp:send or calls:read). Keep tokens on your server; never put them in a mobile app or browser code.
GET https://pbx.itfair.bd/api/v1/ping Authorization: Bearer YOUR_API_TOKEN Accept: application/json
Base URL & rate limits
Base URL: https://pbx.itfair.bd/api. All responses are JSON. Send Accept: application/json to get JSON errors.
| Scope | Limit |
|---|---|
| All authenticated endpoints | 120 requests / minute per token user |
| POST /api/v1/otp/send | 60 / minute per account, 10 / day per destination number |
| POST /api/v1/otp/verify | 300 / minute per account |
| Auto calls and originate | 60 / minute per account, 5 / day per destination number |
Endpoint reference
Voice OTP
Plan feature: Auto Call API & Voice OTP| Endpoint | Token ability | What it does |
|---|---|---|
POST/api/v1/otp/send |
otp:send |
Call a number and read a one-time code. Body: phone_number, optional code (4–8 digits), ttl_minutes (1–30), language (bn|en), intro_id / repeat_id / outro_id (file id or "none"; omit = your default). |
POST/api/v1/otp/verify |
otp:verify |
Check the code the user typed. Body: otp_id, code. |
GET/api/v1/otp/{id} |
otp:send |
Status of an OTP: dispatched, verified or expired. |
Calls
Plan feature: Developer API Access| Endpoint | Token ability | What it does |
|---|---|---|
POST/api/v1/calls/originate |
calls:write |
Click-to-call: ring an extension, then connect it to phone_number. |
GET/api/v1/calls/history |
calls:read |
Call records. Filters: start_date, end_date, phone, extension, disposition, direction. |
GET/api/v1/calls/recordings/{uniqueid} |
calls:read |
Download a call recording (plans with call recording). |
Auto calls
Plan feature: Auto Call API & Voice OTP| Endpoint | Token ability | What it does |
|---|---|---|
POST/api/v1/auto-calls |
calls |
Place an automated call into one of your IVRs. Body: to, ivr_id, optional caller_id, webhook_url, max_attempts (1–3). |
GET/api/v1/auto-calls/{id} |
calls |
Status and result of an auto call. |
Account
Plan feature: Developer API Access| Endpoint | Token ability | What it does |
|---|---|---|
GET/api/v1/ping |
any |
Check that your token works. |
GET/api/v1/balance/global |
billing:read |
Wallet balance. |
GET/api/billing/rates |
billing:read |
Your per-minute call rates. |
CRM
Plan feature: Developer API Access| Endpoint | Token ability | What it does |
|---|---|---|
GET/api/contacts/lookup |
crm |
Find a contact by phone number (screen pop). |
GET/POST/api/contacts |
crm |
List and create contacts. |
GET/api/contacts/{id}/timeline |
crm |
Every call and note for a contact. |
Code examples
Send a voice OTP, then verify it with the returned otp_id.
curl -X POST https://pbx.itfair.bd/api/v1/otp/send \n -H "Authorization: Bearer $TOKEN" \n -H "Accept: application/json" \n -d phone_number=01XXXXXXXXX \n -d ttl_minutes=5
# → 200 OK
{
"status": "dispatched",
"otp_id": 1234,
"expires_at": "2026-09-26T10:05:00+00:00"
}
$res = Http::withToken($token)
->acceptJson()
->post('https://pbx.itfair.bd/api/v1/otp/send', [
'phone_number' => '01XXXXXXXXX',
'ttl_minutes' => 5,
]);
$otpId = $res->json('otp_id'); // keep it to verify
const res = await fetch('https://pbx.itfair.bd/api/v1/otp/send', {
method: 'POST',
headers: {
Authorization: `Bearer ${TOKEN}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({ phone_number: '01XXXXXXXXX', ttl_minutes: 5 }),
});
const { otp_id } = await res.json();
import requests
res = requests.post(
'https://pbx.itfair.bd/api/v1/otp/send',
headers={'Authorization': f'Bearer {TOKEN}', 'Accept': 'application/json'},
data={'phone_number': '01XXXXXXXXX', 'ttl_minutes': 5},
)
otp_id = res.json()['otp_id']
# Verify what the user typed
curl -X POST https://pbx.itfair.bd/api/v1/otp/verify \
-H "Authorization: Bearer $TOKEN" -H "Accept: application/json" \
-d otp_id=1234 -d code=4821
# → 200 {"status":"verified","otp_id":1234,"verified_at":"…"}
Error codes
| Code | Meaning | What to do |
|---|---|---|
| 401 | Unauthenticated | Token missing, wrong or expired. Tokens last 90 days; create a new one in the panel. |
| 403 | Forbidden | The token lacks the ability for this endpoint, or your plan does not include the feature. |
| 404 | Not found | The id does not exist or belongs to another account. |
| 422 | Validation failed | The response body lists each invalid field under "errors". |
| 429 | Too many requests | You hit a rate limit. Wait for the time in the Retry-After header. |
| 402 | Insufficient balance | Recharge your wallet before placing more calls. |
Postman & testing
Import a collection, set the baseUrl and token variables, and every request is ready to send.