Skip to main content

Get call history

Agent Skill

Automate this endpoint with an AI agent using the 2chat-calls skill:

npx skills add 2ChatCo/agent-skills -s 2chat-calls

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​

All parameters are optional.

ParameterDescriptionExample
page_numberPage number to return0
directionFilter by call direction: inbound or outbound, absence means any directionoutbound
to_numberFilter by number called, when the direction is outbound+12124557899
from_numberFilter by number calling, when the direction is inbound+12124557899
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'

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​

FieldDescriptionExample values
uuidUnique identifier of the call detail recordCDRa4b2c8e1-3f7d-4a92-b1e6-9c8d5f2a7b34
callidUnique call session identifierxK7mRpL3vQnW9tY2hBcJ5dFgA8s
directionCall direction: O for outbound, I for inboundO
activeWhether the call is currently in progressfalse
fromUUID of the user or number that initiated the callUSR2c6a9f4e-7b13-4d85-a9e2-3f8c1d6b5a47
to_numberDestination phone number in international format+5215539281047
iso_country_codeTwo-letter country code of the destination numberMX
statusFinal status of the callCOMPLETED
is_whatsapp_callWhether the call was placed over WhatsAppfalse
is_sip_trunk_callWhether the call was placed over a SIP trunktrue
caller_id_uuidUUID of the caller ID used for the callVCI9d4e2f6a-1b83-4c57-a2d9-7e3f8c5b1a64
caller_id_usedPhone number displayed to the recipient+14155527391
durationCall duration in seconds2
recording_urlURL to the call recording file (if available)https://.../.mp3
start_timeTimestamp when the call was answered2026-03-31T01:17:23Z
end_timeTimestamp when the call ended2026-03-31T01:17:25Z
agent_idUUID of the agent who handled the callUSR2c6a9f4e-7b13-4d85-a9e2-3f8c1d6b5a47

Call cost fields​

FieldDescriptionExample values
callidCall session identifier matching the parent recordxK7mRpL3vQnW9tY2hBcJ5dFgA8s
forwardedWhether the call was forwardedfalse
toll_freeWhether the call was to a toll-free numberfalse
start_dtBilling start timestamp2026-03-31T01:17:23Z
end_dtBilling end timestamp2026-03-31T01:17:26Z
durationBilled duration in seconds3
call_priceCost of the call in USD0.0129