WebFones Documentation

Administrator Guide

Menu

Switch to User Guide

Call Log Access API 3.1

The WebFones Call Records API allows you to retrieve call log records and call recordings for your account, including details such as call time, caller/callee, and disposition. This API is designed for integration with CRMs, reporting tools, and automation systems that need access to call history and recordings.

Base URL

https://api.webfones.com:2343

Authentication

All API endpoints require authentication using an API key. The API key must be included in the request headers.

Required Headers

http
x-api-key: YOUR_API_KEY

Alternative:

http
Authorization: Bearer YOUR_API_KEY

Rate Limiting

  • Limit: 1000 requests per 15-minute window per API key (or per IP if no key)
  • Response Code: 429 when limit exceeded
If you exceed the rate limit, you will receive:

json
{ "error": "Too many requests for this API key, please try again later."
}

Endpoints

Call Records

List Call Records After Timestamp

http
GET /call_log/records_after_timestamp?timestamp=

Retrieve all call records for the authenticated account after the specified timestamp.

Query Parameters

ParameterTypeRequiredDescription
—————————————————————————————————————-
timestampstringYesOnly return calls after this timestamp (format: YYYY-MM-DD HH:MM:SS)
Response

json
{ "success": true,
"count": 2,
"records": [
{
"rid": 211159,
"call_timestamp": "2025-07-01 20:54:53",
"cidname_outside": "B WHITTAKER",
"cidext_inside": "3203",
"direction": "OUTGOING",
"cidnumber_outside": "(111) 111-1111",
"cidnumber_inside": "(111) 111-1111, x3203",
"disposition": "ANSWERED",
...
}
]
}

If there are no records:

json
{ "success": true,
"count": 0,
"records": []
}

Call Recordings

Download Call Recording

http
GET /call_log/recording/:rid

Retrieve the audio recording for a specific call by its record ID (rid). The recording is returned as a binary audio stream.

Path Parameters

ParameterTypeRequiredDescription
ridintegerYesThe record ID from the call log (obtained from records_after_timestamp)
Response

On success (HTTP 200), the response contains the raw audio data with the following headers:

HeaderValue
Content-Typeaudio/wav (or actual audio format)
Content-LengthFile size in bytes
Content-Dispositioninline; filename="recording-{rid}.wav"
Recording Error Responses

StatusErrorDescription
400Invalid record IDThe rid parameter is not a valid number
404Recording not foundRecord doesn't exist or doesn't belong to your account
404No recording availableThe call exists but has no recording
502Failed to fetch recordingError retrieving from storage
Example: Download Recording with curl

bash
curl -X GET \
-H "x-api-key: YOUR_API_KEY" \
"https://api.webfones.com:2343/call_log/recording/211159" \
--output recording_211159.wav

Example: Download Recording with PHP

php
$apiKey = 'YOUR_API_KEY';
$rid = 211159;
$url = "https://api.webfones.com:2343/call_log/recording/{$rid}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-api-key: ' . $apiKey]);
$audio = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
file_put_contents("recording_{$rid}.wav", $audio);
echo "Recording saved (" . strlen($audio) . " bytes)\n";
} else {
echo "Error: Recording not available\n";
}

Example: Download Recording with Python

python
import requests

API_KEY = 'YOUR_API_KEY'
rid = 211159
url = f'https://api.webfones.com:2343/call_log/recording/{rid}'

response = requests.get(url, headers={'x-api-key': API_KEY})

if response.status_code == 200:
with open(f'recording_{rid}.wav', 'wb') as f:
f.write(response.content)
print(f'Recording saved ({len(response.content)} bytes)')
else:
print('Error: Recording not available')

:::note
Not all calls have recordings. Missed calls, unanswered calls, or calls where recording was disabled will return a 404 error. The rid value is obtained from the call log records returned by /call_log/records_after_timestamp.
:::

Error Codes

  • 400 Bad Request
json
{ "error": "Missing timestamp in query"
}
  • 401 Unauthorized
json
{ "error": "Missing API key"
}
  • 403 Forbidden
json
{ "error": "Invalid API key"
}
  • 429 Too Many Requests
json
{ "error": "Too many requests from this IP, please try again later."
}
  • 500 Internal Server Error
json
{ "error": "Internal server error",
"message": "An unexpected error occurred",
"timestamp": "2025-06-19T10:30:00.000Z"
}

Example Requests

Using curl

bash
curl -X GET \
-H "x-api-key: YOUR_API_KEY" \
"https://api.webfones.com:2343/call_log/records_after_timestamp?timestamp=2025-07-01%2014:53:43"

Using PHP

php
$call) {
echo ($i+1) . ". Call ID: " . ($call['rid'] ?? 'N/A') . ", Timestamp: " . ($call['call_timestamp'] ?? 'N/A') . ", Caller: " . ($call['cidnumber_outside'] ?? 'N/A') . "\n";
}

Using JavaScript

javascript
const apiKey = 'YOUR_API_KEY';
const baseUrl = 'https://api.webfones.com:2343';
const timestamp = new Date(Date.now() - 6 3600 1000).toISOString().replace('T', ' ').substring(0, 19); // 'YYYY-MM-DD HH:MM:SS'
const url = ${ baseUrl }/call_log/records_after_timestamp?timestamp=${encodeURIComponent(timestamp)};
fetch(url, {
method: 'GET',
headers: {
'x-api-key': apiKey,
'Accept': 'application/json'
}
})
.then(res => res.json())
.then(data => {
if (data.records && data.records.length > 0) {
data.records.forEach((call, i) => {
console.log(${ i+1 }. Call ID: ${call.rid}, Timestamp: ${call.call_timestamp}, Caller: ${call.cidnumber_outside});
});
} else {
console.log('No calls found in the last 6 hours.');
}
});

Using Python

python
import requests
from datetime import datetime, timedelta

API_KEY = ‘YOUR_API_KEY’
BASE_URL = ‘https://api.webfones.com:2343’
timestamp = (datetime.utcnow() – timedelta(hours=6)).strftime(‘%Y-%m-%d %H:%M:%S’)
url = f’{BASE_URL}/call_log/records_after_timestamp?timestamp={timestamp.replace(” “, “%20”)}’
headers = {
‘x-api-key’: API_KEY,
‘Accept’: ‘application/json’
} response = requests.get(url, headers=headers)
if response.status_code != 200:
print(f’API error ({response.status_code}): {response.text}’)
exit(1)
data = response.json()
if not data.get(‘records’):
print(‘No calls found in the last 6 hours.’)
else:
for i, call in enumerate(data[‘records’]):
print(f”{i+1 }. Call ID: {call.get(‘rid’, ‘N/A’)}, Timestamp: {call.get(‘call_timestamp’, ‘N/A’)}, Caller: {call.get(‘cidnumber_outside’, ‘N/A’)}”)

Support

For questions, API key requests, or troubleshooting, contact your WebFones administrator or support team.

AI Documentation Assistant

Suggested Questions

How do I set up call forwarding? What is a ring group? How do I check voicemail? How do I add a new extension?
Thinking...