Authentication

Callr supports two authentication methods. We recommend the x-api-key header. Use Basic Authentication only when you need to act on behalf of a sub account.

API-Key header (recommended)

Send your API Key in the x-api-key HTTP header. With this method, you act on your main account.

curl --request GET \
     --url https://api.callr.com/v2.0/ping \
     --header 'accept: application/json' \
     --header 'x-api-key: <callr-api-key>'
GET /v2.0/ping HTTP/2
Host: api.callr.com
accept: application/json
x-api-key: <callr-api-key>

Basic Authentication

You may also use HTTP Basic Authentication, by sending your main account SID as the user, and your API key as the password.

Your account SID is shown in the Callr Console, under Configuration → Account → Company (field Account SID).

curl --request GET \
     --url https://api.callr.com/v2.0/ping \
     --header 'accept: application/json' \
     --user '<your-account-sid>:<your-api-key>'
GET /v2.0/ping HTTP/2
Host: api.callr.com
authorization: Basic PHlvdXItYWNjb3VudC1zaWQ+OjxjYWxsci1hcGkta2V5Pg==
accept: application/json

Sub Accounts

If you have sub accounts, you can act as a sub account by sending the sub account SID as the user, and your master account API key as the password.

curl --request GET \
     --url https://api.callr.com/v2.0/ping \
     --header 'accept: application/json' \
     --user '<your-sub-account-sid>:<your-master-account-api-key>'
GET /v2.0/ping HTTP/2
Host: api.callr.com
authorization: Basic PHlvdXItc3ViLWFjY291bnQtc2lkPjo8eW91ci1tYXN0ZXItYWNjb3VudC1hcGkta2V5Pg==
accept: application/json

Authentication errors

A missing or invalid API key returns 401 Unauthorized:

{
  "code": "auth_error",
  "message": "Authentication failed"
}

API keys are shown only once, when you create them. See Best Practices to store and rotate them, and Errors for all error codes.