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 Go 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 go \
-i https://api.callr.com/v2.0/openapi.json \
-o /local/callr-v2-goAuthenticate 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 Go for the CALLR API.
Works with Go 1.11+ (this is a go module), using standard packages only.
import callr "github.com/THECALLR/sdk-go"
func main() {
// use Api Key Auth (recommended) - use the customer portal to generate keys
api := callr.NewWithAPIKeyAuth("key")
result, err := api.Call("method", params...)target := map[string]interface{}{
"number": "+33123456789",
"timeout": 30,
}
messages := []interface{}{
131,
132,
"TTS|TTS_EN-GB_SERENA|Hello world! how are you ? I hope you enjoy this call. good bye."
}
options := map[string]interface{}{
"cdr_field": "userData",
"cli": "BLOCKED",
"loop": 2,
}
result, err := api.Call("calls.broadcast_1", target, messages, options)target := map[string]interface{}{
"number": "+33123456789",
"timeout": 30,
}
messages := []interface{}{
131,
132,
134,
}
result, err := api.Call("calls.broadcast_1", target, messages, nil)Method
Objects
options := map[string]interface{}{
"url": "http://yourdomain.com/realtime_callback_url",
}
result, err := api.Call("apps.create", "REALTIME10", "Your app name", options)Method
Objects
target := map[string]interface{}{
"number": "+33132456789",
"timeout": 30,
}
callOptions := map[string]interface{}{
"cdr_field": "42",
"cli": "BLOCKED",
}
result, err := api.Call("calls.realtime", "appHash", target, callOptions)Method
Objects
result, err := api.Call("apps.assign_did", "appHash", "DID ID")Method
Objects
result, err := api.Call("sms.send", "SMS", "+33123456789", "Hello, world", nil)Method
Your sender must have been authorized and respect the sms_sender format
result, err := api.Call("sms.send", "Your Brand", "+33123456789", "Hello world!", nil)Method
result, err := api.Call("sms.send", "", "+33123456789", "Hello world!", nil)Method
optionSMS := map[string]interface{}{
"force_encoding": "GSM",
}
result, err := api.Call("sms.send", "", "+33123456789", "Hello world!", optionSMS)Method
Objects
var text bytes.Buffer
text.WriteString("Some super mega ultra long text to test message longer than 160 characters ")
text.WriteString("Some super mega ultra long text to test message longer than 160 characters ")
text.WriteString("Some super mega ultra long text to test message longer than 160 characters")
result, err := api.Call("sms.send", "SMS", "+33123456789", text.String(), nil)Method
optionSMS := map[string]interface{}{
"nature": "ALERTING",
}
result, err := api.Call("sms.send", "SMS", "+33123456789", "Hello world!", optionSMS)Method
Objects
optionSMS := map[string]interface{}{
"user_data": "42",
}
result, err := api.Call("sms.send", "SMS", "+33123456789", "Hello world!", optionSMS)Method
Objects
optionSMS := map[string]interface{}{
"webhook": map[string]interface{}{
"endpoint":"http://yourdomain.com/webhook_endpoint",
},
}
result, err := api.Call("sms.send", "SMS", "+33123456789", "Hello world!", optionSMS)Method
Objects
Do not set a sender if you want to receive replies - we will automatically use a shortcode.
optionSMS := map[string]interface{}{
"webhook": map[string]interface{}{
"endpoint":"http://yourdomain.com/webhook_endpoint",
},
}
result, err := api.Call("sms.send", "", "+33123456789", "Hello world!", optionSMS)Method
Objects
result, err := api.Call("sms.get", "SMSHASH")Method
Objects
result, err := api.Call("did/areacode.countries")Method
Objects
result, err := api.Call("did/areacode.get_list", "US", nil)Method
Objects
result, err := api.Call("did/areacode.types", "US")Method
Objects
result, err := api.Call("did/store.buy_order", "OrderToken")Method
Objects
result, err := api.Call("did/store.cancel_order", "OrderToken")Method
result, err := api.Call("did/store.cancel_subscription", "DID ID")Method
result, err := api.Call("did/store.get_quota_status")Method
Objects
result, err := api.Call("did/store.get_quote", 0, "GOLD", 1)Method
*Objects/
result, err := api.Call("did/store.reserve", 0, "GOLD", 1, "RANDOM")Method
Objects
result, err := api.Call("did/store.view_order", "OrderToken")Method
Objects
result, err := api.Call("media/library.get_list", nil)Method
result, err := api.Call("media/library.create", "name")Method
mediaID := 0
result, err := api.Call("media/library.set_content_from_file", mediaID, "imported temporary file name")Method
mediaID := 0
result, err := api.Call("media/tts.set_content", mediaID, "Hello world!", "TTS-EN-GB_SERENA", nil)Method