Skip to main content

Working with Calls

The Calls API is one of the most used features of SIPSIM. Learn how to retrieve call history, filter results, and access detailed call information.

Required Scopes

  • calls.read — Required to list and view calls

List Calls

Retrieve a list of calls within a time range:

curl "https://app.sipsim.com/api/v2/calls?start_time=2024-01-01T00:00:00Z&end_time=2024-01-31T23:59:59Z" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Required Parameters

ParameterTypeDescription
start_timestringISO 8601 datetime for the beginning of the time range

Optional Parameters

ParameterTypeDescription
end_timestringISO 8601 datetime for the end of the range (defaults to now)
employeesstringComma-separated list of employee IDs
tagsstringComma-separated list of tag IDs
call_typesstringComma-separated: inbound, outgoing, missed, voicemail
searchstringSearch by phone number or caller name
limitintegerResults per page (20-1000, default: 1000)
pagestringPagination token for next page

Filtering Calls

By Call Type

Get only missed calls:

curl "https://app.sipsim.com/api/v2/calls?start_time=2024-01-01T00:00:00Z&call_types=missed" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Get inbound and outgoing calls (exclude missed and voicemail):

curl "https://app.sipsim.com/api/v2/calls?start_time=2024-01-01T00:00:00Z&call_types=inbound,outgoing" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

By Employee

Filter calls for specific employees:

curl "https://app.sipsim.com/api/v2/calls?start_time=2024-01-01T00:00:00Z&employees=123,456,789" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

By Tags

Get calls with specific tags:

curl "https://app.sipsim.com/api/v2/calls?start_time=2024-01-01T00:00:00Z&tags=10,20" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

By Phone Number

Search for calls involving a specific number:

curl "https://app.sipsim.com/api/v2/calls?start_time=2024-01-01T00:00:00Z&search=+33612345678" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Call Object

Each call in the response includes:

{
"id": 12345,
"call_type": "inbound",
"sip_status": "answer",
"caller_number": "+33612345678",
"target_number": "+33698765432",
"answered_phone_number": "+33698765432",
"answered": true,
"wait_duration_sec": 5,
"duration_sec": 120,
"play_record_link": "https://example.com/recordings/call_12345.mp3",
"phone_id": 456,
"answered_phone_id": 789,
"registration_time": "2024-01-15T10:30:00Z",
"start_time": "2024-01-15T10:30:05Z",
"answered_time": "2024-01-15T10:30:10Z",
"end_time": "2024-01-15T10:32:10Z",
"tags": [
{"id": 10, "name": "Important"}
]
}

Call Fields

FieldTypeDescription
idintegerUnique call identifier
call_typestringinbound, outbound, missed, or voicemail
sip_statusstringSIP status: answer, cancel, no_answer, busy, unavailable, other
caller_numberstringPhone number of the caller (E.164 format)
target_numberstringPhone number that was called (E.164 format)
answered_phone_numberstringPhone number that answered the call (nullable)
answeredbooleanWhether the call was answered
wait_duration_secintegerDuration in seconds the call waited before being answered
duration_secintegerTotal duration of the call in seconds
play_record_linkstringURL to the call recording (nullable)
phone_idintegerID of the phone associated with the call
answered_phone_idintegerID of the phone that answered (nullable)
registration_timestringTime when the call was registered (ISO 8601)
start_timestringTime when the call started (ISO 8601)
answered_timestringTime when the call was answered (nullable, ISO 8601)
end_timestringTime when the call ended (ISO 8601)
tagsarrayTags attached to this call (id and name)

Get a Single Call

Retrieve detailed information about a specific call:

curl "https://app.sipsim.com/api/v2/calls/12345" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Practical Examples

Daily Call Report

Generate a daily summary of calls:

import requests
from datetime import datetime, timedelta
from collections import Counter

access_token = "YOUR_ACCESS_TOKEN"

# Yesterday's calls
yesterday = datetime.utcnow().date() - timedelta(days=1)
start_time = datetime.combine(yesterday, datetime.min.time())
end_time = datetime.combine(yesterday, datetime.max.time())

response = requests.get(
"https://app.sipsim.com/api/v2/calls",
headers={"Authorization": f"Bearer {access_token}"},
params={
"start_time": start_time.isoformat() + "Z",
"end_time": end_time.isoformat() + "Z",
"limit": 1000
}
)

calls = response.json()["data"]

# Analyze
call_types = Counter(c["call_type"] for c in calls)
total_duration = sum(c["duration_sec"] or 0 for c in calls)

print(f"=== Call Report for {yesterday} ===")
print(f"Total calls: {len(calls)}")
print(f" Inbound: {call_types['inbound']}")
print(f" Outbound: {call_types['outbound']}")
print(f" Missed: {call_types['missed']}")
print(f" Voicemail: {call_types['voicemail']}")
print(f"Total talk time: {total_duration // 60} minutes")

Find Long Calls

Find all calls longer than 30 minutes:

import requests

access_token = "YOUR_ACCESS_TOKEN"

response = requests.get(
"https://app.sipsim.com/api/v2/calls",
headers={"Authorization": f"Bearer {access_token}"},
params={
"start_time": "2024-01-01T00:00:00Z",
"limit": 1000
}
)

calls = response.json()["data"]
long_calls = [c for c in calls if (c["duration_sec"] or 0) > 1800]

print(f"Found {len(long_calls)} calls longer than 30 minutes:")
for call in long_calls:
minutes = call["duration_sec"] // 60
print(f" {call['id']}: {minutes} min - {call['caller_number']} -> {call['target_number']}")

Export to CSV

Export calls to CSV for further analysis:

import requests
import csv

access_token = "YOUR_ACCESS_TOKEN"

response = requests.get(
"https://app.sipsim.com/api/v2/calls",
headers={"Authorization": f"Bearer {access_token}"},
params={
"start_time": "2024-01-01T00:00:00Z",
"end_time": "2024-01-31T23:59:59Z",
"limit": 1000
}
)

calls = response.json()["data"]

with open("calls_export.csv", "w", newline="") as f:
writer = csv.DictWriter(f, fieldnames=[
"id", "call_type", "sip_status", "caller_number",
"target_number", "duration_sec", "start_time", "answered"
])
writer.writeheader()
for call in calls:
writer.writerow({
"id": call["id"],
"call_type": call["call_type"],
"sip_status": call["sip_status"],
"caller_number": call["caller_number"],
"target_number": call["target_number"],
"duration_sec": call["duration_sec"],
"start_time": call["start_time"],
"answered": call["answered"]
})

print(f"Exported {len(calls)} calls to calls_export.csv")

Next Steps