This SDK targets the legacy Callr JSON-RPC API (v1), which is deprecated and will be shut down on 30 June 2027. After that date this SDK will stop working.
➡️ Please migrate to the new Callr REST API v2.
- 📘 Migration guide (JSON-RPC → REST API v2): https://docs.callr.com/reference/migrating-from-json-rpc-v1
- 📣 What's new in REST API v2: https://docs.callr.com/changelog/rest-api-v2-is-here
- 🌐 REST API v2 base URL:
https://api.callr.com/v2.0- ✉️ Questions / migration help: support@callr.com
Your existing API credentials work with REST API v2 — no new keys required.
Official Callr REST API v2 SDKs are coming in the near future. In the meantime, you can call the REST API directly, or generate a client from the OpenAPI 3.1 spec (see Generate a REST API v2 client today below).
An official Callr REST API v2 SDK for Python is coming soon. Until then, generate a fully-typed client from the OpenAPI 3.1 spec with OpenAPI Generator (requires v7.x+ for OpenAPI 3.1):
docker run --rm -v "$PWD:/local" openapitools/openapi-generator-cli generate \
-g python \
-i https://api.callr.com/v2.0/openapi.json \
-o /local/callr-v2-pythonAuthenticate with your API Key via the x-api-key header (or HTTP Basic: Account SID + API Key). The base URL https://api.callr.com/v2.0 is baked into the generated client — see its generated docs/ for the available endpoints.
SDK in Python for CALLR API
Install via PyPI
pip install callr
Or get sources from Github
Pip
import callr
api = callr.Api("login", "password")Source
import sys
sys.path.append("/path/to/callr_folder")
import callr
api = callr.Api("login", "password")try:
# Set your credentials
api = callr.Api("login", "password")
# This will raise an exception
api.call("sms.send", "SMS")
# Exceptions handler
except (callr.CallrException, callr.CallrLocalException) as e:
print "ERROR: %s" % e.code
print "MESSAGE: %s" % e.msg
print "DATA: ", e.dataresult = api.call('sms.send', 'SMS', '+33123456789', 'Hello world!', None)Method
Your sender must have been authorized and respect the sms_sender format
result = api.call('sms.send', 'Your Brand', '+33123456789', 'Hello world!', None)Method
result = api.call('sms.send', '', '+33123456789', 'Hello world!', None)Method
optionSMS = { 'force_encoding': 'GSM' }
result = api.call('sms.send', '', '+33123456789', 'Hello world!', optionSMS)Method
Objects
text = ('Some super mega ultra long text to test message longer than 160 characters ' +
'Some super mega ultra long text to test message longer than 160 characters ' +
'Some super mega ultra long text to test message longer than 160 characters')
result = api.call('sms.send', 'SMS', '+33123456789', text, None)Method
optionSMS = { 'nature': 'ALERTING' }
result = api.call('sms.send', 'SMS', '+33123456789', 'Hello world!', optionSMS)Method
Objects
optionSMS = { 'user_data': '42' }
result = api.call('sms.send', 'SMS', '+33123456789', 'Hello world!', optionSMS)Method
Objects
optionSMS = {
'webhook': { 'endpoint': 'https://yourdomain.com/webhook_endpoint' }
}
result = api.call('sms.send', 'SMS', '+33123456789', 'Hello world!', optionSMS)Method
Objects
result = api.call('sms.get', 'SMSHASH')Method
Objects
options = {
'url': 'https://yourdomain.com/realtime_callback_url'
}
result = api.call('apps.create', 'REALTIME10', 'Your app name', options)Method
Objects
target = {
'number': '+33132456789',
'timeout': 30
}
callOptions = {
'cdr_field': '42',
'cli': 'BLOCKED'
}
result = api.call('dialr/call.realtime', 'appHash', target, callOptions)Method
Objects
result = api.call('apps.assign_did', 'appHash', 'DID ID')Method
Objects
result = api.call('did/areacode.countries')Method
Objects
result = api.call('did/areacode.get_list', 'US', None)Method
Objects
result = api.call('did/areacode.types', 'US')Method
Objects
result = api.call('did/store.buy_order', 'OrderToken')Method
Objects
result = api.call('did/store.cancel_order', 'OrderToken')Method
result = api.call('did/store.cancel_subscription', 'DID ID')Method
result = api.call('did/store.get_quota_status')Method
Objects
result = api.call('did/store.get_quote', 0, 'GOLD', 1)Method
*Objects/
result = api.call('did/store.reserve', 0, 'GOLD', 1, 'RANDOM')Method
Objects
result = api.call('did/store.view_order', 'OrderToken')Method
Objects
params = { 'open': True }
access = []
result = api.call('conference/10.create_room', 'room name', params, access)Method
Objects
result = api.call('conference/10.assign_did', 'Room ID', 'DID ID')Method
params = { 'open': True }
access = [
{ 'pin': '1234', 'level': 'GUEST' },
{ 'pin': '4321', 'level': 'ADMIN', 'phone_number': '+33123456789' }
]
result = api.call('conference/10.create_room', 'room name', params, access)Method
Objects
result = api.call('conference/10.call_room_access', 'Room Access ID', 'BLOCKED', True)Method
result = api.call('media/library.get_list', None)Method
result = api.call('media/library.create', 'name')Method
media_id = 0
result = api.call('media/library.set_content', media_id, 'text', 'base64_audio_data')Method
media_id = 0
result = api.call('media/tts.set_content', media_id, 'Hello world!', 'TTS-EN-GB_SERENA', None)Method
from = 'YYYY-MM-DD HH:MM:SS'
to = 'YYYY-MM-DD HH:MM:SS'
result = api.call('cdr.get', 'OUT', from, to, None, None)Method
Objects
target = {
'number': '+33123456789',
'timeout': 30
}
messages = [131, 132, 'TTS|TTS_EN-GB_SERENA|Hello world! how are you ? I hope you enjoy this call. good bye.']
options = {
'cdr_field': 'userData',
'cli': 'BLOCKED',
'loop': 2
}
result = api.call('sendr/simple.broadcast_1', target, messages, options)target = {
'number': '+33123456789',
'timeout': 30
}
messages = [131, 132, 134]
result = api.call('sendr/simple.broadcast_1', target, messages, None)Method
Objects