Get call history
Retrieve the history of phone calls made or received through your 2Chat account. You can filter by call direction to see only inbound or outbound calls.
Query parameters
| Parameter | Description | Example |
|---|---|---|
page_number | Page number to return | 0 |
direction | Filter by call direction: inbound or outbound, absence means any direction | outbound |
- cURL
- Python
- JavaScript
curl -L -G 'https://api.p.2chat.io/open/voip/call-history?page_number=0&direction=outbound' \
--header 'X-User-API-Key: your_api_key_here'
import requests
url = "https://api.p.2chat.io/open/voip/call-history?page_number=0&direction=outbound"
payload = ""
headers = {
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = '';
var config = {
method: 'get',
url: 'https://api.p.2chat.io/open/voip/call-history?page_number=0&direction=outbound',
headers: {
'X-User-API-Key': 'your_api_key_here'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Response
The API will return an array of call detail records (CDRs) for your account.
{
"success": true,
"count": 1257,
"page": 0,
"cdrs": [
{
"uuid": "CDRa4b2c8e1-3f7d-4a92-b1e6-9c8d5f2a7b34",
"account_uuid": "ACC7e3f1a9b-8c42-4d15-a6b3-2e9f7c5d8a41",
"callid": "xK7mRpL3vQnW9tY2hBcJ5dFgA8s",
"direction": "O",
"active": false,
"from": "USR2c6a9f4e-7b13-4d85-a9e2-3f8c1d6b5a47",
"iso_country_code": "MX",
"status": "COMPLETED",
"is_whatsapp_call": false,
"is_sip_trunk_call": true,
"created_at": "2026-03-31T01:17:22Z",
"updated_at": "2026-03-31T01:17:28Z",
"to_number": "+5215539281047",
"caller_id_uuid": "VCI9d4e2f6a-1b83-4c57-a2d9-7e3f8c5b1a64",
"caller_id_used": "+14155527391",
"duration": 2,
"recording_url": "https://2chat-user-data.s3.amazonaws.com/ACC7e3f1a9b-8c42-4d15-a6b3-2e9f7c5d8a41/calls/xK7mRpL3vQnW9tY2hBcJ5dFgA8s.mp3",
"start_time": "2026-03-31T01:17:23Z",
"end_time": "2026-03-31T01:17:25Z",
"agent_id": "USR2c6a9f4e-7b13-4d85-a9e2-3f8c1d6b5a47",
"call_cost": {
"callid": "xK7mRpL3vQnW9tY2hBcJ5dFgA8s",
"forwarded": false,
"toll_free": false,
"start_dt": "2026-03-31T01:17:23Z",
"end_dt": "2026-03-31T01:17:26Z",
"duration": 3,
"call_price": 0.0129
}
}
]
}
Response fields
| Field | Description | Example values |
|---|---|---|
uuid | Unique identifier of the call detail record | CDRa4b2c8e1-3f7d-4a92-b1e6-9c8d5f2a7b34 |
callid | Unique call session identifier | xK7mRpL3vQnW9tY2hBcJ5dFgA8s |
direction | Call direction: O for outbound, I for inbound | O |
active | Whether the call is currently in progress | false |
from | UUID of the user or number that initiated the call | USR2c6a9f4e-7b13-4d85-a9e2-3f8c1d6b5a47 |
to_number | Destination phone number in international format | +5215539281047 |
iso_country_code | Two-letter country code of the destination number | MX |
status | Final status of the call | COMPLETED |
is_whatsapp_call | Whether the call was placed over WhatsApp | false |
is_sip_trunk_call | Whether the call was placed over a SIP trunk | true |
caller_id_uuid | UUID of the caller ID used for the call | VCI9d4e2f6a-1b83-4c57-a2d9-7e3f8c5b1a64 |
caller_id_used | Phone number displayed to the recipient | +14155527391 |
duration | Call duration in seconds | 2 |
recording_url | URL to the call recording file (if available) | https://.../.mp3 |
start_time | Timestamp when the call was answered | 2026-03-31T01:17:23Z |
end_time | Timestamp when the call ended | 2026-03-31T01:17:25Z |
agent_id | UUID of the agent who handled the call | USR2c6a9f4e-7b13-4d85-a9e2-3f8c1d6b5a47 |
Call cost fields
| Field | Description | Example values |
|---|---|---|
callid | Call session identifier matching the parent record | xK7mRpL3vQnW9tY2hBcJ5dFgA8s |
forwarded | Whether the call was forwarded | false |
toll_free | Whether the call was to a toll-free number | false |
start_dt | Billing start timestamp | 2026-03-31T01:17:23Z |
end_dt | Billing end timestamp | 2026-03-31T01:17:26Z |
duration | Billed duration in seconds | 3 |
call_price | Cost of the call in USD | 0.0129 |