API Reference

Get the list of bought numbers API

GET
/{channel}/v1/account/numbers

Get the list of bought numbers API

Filters

Parameter Data Type Required Description
user_plan_id String No user_plan_id you get from account_info get API
expiry_time String No Expiry time of the number it should be greater than current time and less than or equal to the plan expiry time
number String No number you want to allocate get from the AvailablePhoneNumbers API
Example
Python :

import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/numbers/"

headers = {
    'authorization': "XXXXXX-XXXX-XXXX-XXXXXXXXX",
    'x-api-key': "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/numbers/",
  "method": "GET",
  "headers": {
    "authorization": "XXXXXXX-XXXX-XXXX-XXXXXXX",
    "x-api-key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

PHP :
 "https://kpi.knowlarity.com/Basic/v1/account/numbers/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: XXXXXX-XXXX-XXXX-XXXXXXXXXX",
    "x-api-key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
Header:
    x-api-key: APPLICATION ACCESS KEY
    Authorization: SR_API_KEY
    content-type : application/json
Path:
    channel: Basic
Sample Response
{
   "meta": {
       "limit": 1000,
       "next": "",
       "offset": 0,
       "previous": "",
       "total_count": 9
   },
   "objects": [
       {
           "cli_type": "NONE",
           "created_time": "2016-10-21 07:25:05+00:00",
           "expiry_time": "2017-10-20 18:30:00+00:00",
           "is_expired": false,
           "number_type": "1",
           "phone_number": "+91XXXXXXXXXX",
           "number_rating": -1
       },
       {
           "cli_type": "NONE",
           "created_time": "2016-10-20 06:27:59+00:00",
           "expiry_time": "2017-10-19 18:30:00+00:00",
           "is_expired": false,
           "number_type": "1",
           "phone_number": "+91XXXXXXXXXX",
           "number_rating": -1
       },
       {
           "cli_type": "NONE",
           "created_time": "2017-01-02 04:35:14+00:00",
           "expiry_time": "2017-10-19 18:30:00+00:00",
           "is_expired": false,
           "number_type": "1",
           "phone_number": "+91XXXXXXXXXX",
           "number_rating": -1
       },
       {
           "cli_type": "NONE",
           "created_time": "2016-10-20 14:53:35+00:00",
           "expiry_time": "2017-10-19 18:30:00+00:00",
           "is_expired": false,
           "number_type": "1",
           "phone_number": "+91XXXXXXXXXX",
           "number_rating": -1
       },
       {
           "cli_type": "NONE",
           "created_time": "2017-04-25 04:42:16+00:00",
           "expiry_time": "2017-04-25 18:30:00+00:00",
           "is_expired": true,
           "number_type": "1",
           "phone_number": "+91XXXXXXXXXX",
           "number_rating": -1
       },
       {
           "cli_type": "NONE",
           "created_time": "2017-04-24 13:47:55+00:00",
           "expiry_time": "2017-04-24 18:30:00+00:00",
           "is_expired": true,
           "number_type": "1",
           "phone_number": "+91XXXXXXXXXX",
           "number_rating": -1
       },
       {
           "cli_type": "NONE",
           "created_time": "2017-04-24 13:46:38+00:00",
           "expiry_time": "2017-04-24 18:30:00+00:00",
           "is_expired": true,
           "number_type": "1",
           "phone_number": "+91XXXXXXXXXX",
           "number_rating": -1
       },
       {
           "cli_type": "NONE",
           "created_time": "2017-04-24 13:55:42+00:00",
           "expiry_time": "2017-04-24 18:30:00+00:00",
           "is_expired": true,
           "number_type": "1",
           "phone_number": "+91XXXXXXXXXX",
           "number_rating": -1
       },
       {
           "cli_type": "NONE",
           "created_time": "2017-04-24 13:51:26+00:00",
           "expiry_time": "2017-04-24 18:30:00+00:00",
           "is_expired": true,
           "number_type": "1",
           "phone_number": "+91XXXXXXXXXX",
           "number_rating": -1
       }
   ]
}

Create Order - OBD Call Center

POST
/{channel}/v1/account/call-center/create_order/

Call Center API to create an order.

Body Description

Parameter Data Type Required Description
sound_id/ivr_id Integer Yes Id of the approved sound or Ivr
phonebook String No Id of the phonebook. It will be required if user is not passing any additional_number
timezone String Yes Timezone in which user want to place campaign
priority Integer No The value should be in between 1 and 10
order_throttling Integer No Maximum parallel calls
start_time string Yes Start time of the order and it should be in the format yyyy-MM-dd HH:mm
end_time(optional) string No End time of the order and it should be in the format yyyy-MM-dd HH:mm
call_scheduling string No Weekdays on which user want to schedule the campaign.Representing it in array format like "[1, 1, 1, 1, 1, 0, 0]" starting from monday to sunday, 1 if user want to schedule the call on the day and 0 otherwise.
call_scheduling_start_time string No Campaign start time per day. Default is 9:00
call_scheduling_stop_time string No Campaign stop time per day. Default is 21:00
k_number string Yes SR number of Enterprise Plan
additional_number string No Numbers on which user want to run the campaign. "additonal_number" field is mandatory.It has to be passed everytime. Required if phonebook is not provided or if some numbers need to be added other than the numbers in the phonebook
is_transactional string No Value will be True/False or true/false or 1/0, and if the value is True/true/1 then transactional campaign will be created otherwise promotional and default value is False/false/0. Any value other than these will lead to placing a Promotional call.
.
outbound_callcenter Integer No Value will be "1", Required when creating a Outbound Call Center Order
user_plan_id Integer No Value will be corresponding to the plan id of the User .
Ivr_disp_num string Yes Mandatory paramter. SR number belonging to Enterprise SIVR Plan
Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/call-center/create_order/"

payload = "{\n     \"ivr_id\":\"100xxxxx20\",\n     \"additional_number\":\"+919xxxxxxx89\", \n     \"timezone\":\"Asia/Kolkata\", \n     \"priority\":10, \n     \"order-throttling\":2,\n     \"start_time\":\"2018-07-20 18:17\", \n     \"call_scheduling_start_time\":\"09:00\" ,\n     \"call_scheduling_stop_time\":\"23:00\" ,\n     \"is_transactional\":1 ,\n     \"user_plan_id\":440274 ,\n     \"outbound_callcenter\":1 ,\n     \"call_scheduling\":[1,1,1,1,1,1,1] ,\n     \"end_time\":\"2018-07-20 18:35\"\n}"
headers = {
    'authorization': "550xxxxxxxxxxxxxxxxxxa97e612",
    'content-type': "application/json",
    'x-api-key': "NRMxxxxxxxxxxxxxxxxxx8rxsDMlo",

    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/call-center/create_order/",
  "method": "POST",
  "headers": {
    "authorization": "550xxxxxxxxxxxxxxx4a97e612",
    "content-type": "application/json",
    "x-api-key": "NRxxxxxxxxxxxxxxxxxxxxxxxx4iVH768rxsDMlo",
  },
  "processData": false,
  "data": "{\n     \"ivr_id\":\"10xxxxxxxx0520\",\n     \"additional_number\":\"+91xxxxxx589\", \n     \"timezone\":\"Asia/Kolkata\", \n     \"priority\":10, \n     \"order-throttling\":2,\n     \"start_time\":\"2018-07-20 18:17\", \n     \"call_scheduling_start_time\":\"09:00\" ,\n     \"call_scheduling_stop_time\":\"23:00\" ,\n     \"is_transactional\":1 ,\n     \"user_plan_id\":44xx74 ,\n     \"outbound_callcenter\":1 ,\n     \"call_scheduling\":[1,1,1,1,1,1,1] ,\n     \"end_time\":\"2018-07-20 18:35\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

PHP :

 "https://kpi.knowlarity.com/Basic/v1/account/call-center/create_order/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n     \"ivr_id\":\"10xxxxxx0\",\n     \"additional_number\":\"+9199xxxxx589\", \n     \"timezone\":\"Asia/Kolkata\", \n     \"priority\":10, \n     \"order-throttling\":2,\n     \"start_time\":\"2018-07-20 18:17\", \n     \"call_scheduling_start_time\":\"09:00\" ,\n     \"call_scheduling_stop_time\":\"23:00\" ,\n     \"is_transactional\":1 ,\n     \"user_plan_id\":4xxx74 ,\n     \"outbound_callcenter\":1 ,\n     \"call_scheduling\":[1,1,1,1,1,1,1] ,\n     \"end_time\":\"2018-07-20 18:35\"\n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: 5508xxxxxxxxxxxxxxxxxxxx8874a97e612",
    "cache-control: no-cache",
    "content-type: application/json",
    "x-api-key: NRMxxxEB9xxxxxxxxxxxxxxxxxxxxxx8rxsDMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
{
     "ivr_id":"100xxxxxxxx",
     "additional_number":"+9199xxxxxxx", 
     "timezone":"Asia/Kolkata", 
     "priority":10, 
     "order-throttling":2, 
     "start_time":"2018-07-18 18:17", 
     "call_scheduling_start_time":"09:00" ,
     "call_scheduling_stop_time":"23:00" ,
     "is_transactional":1 ,
     "user_plan_id":44xx4 ,
     "outbound_callcenter":1 ,
     "call_scheduling":[1,1,1,1,1,1,1] ,
     "end_time":"2018-07-18 18:35"
}
Sample Response
{
  "order_id": 175,
  "result": "placed order successfully",
  "status_code": 1
}

ADD Call to order - OBD Call Center

PUT
/{channel}/v1/account/call-center/add_call_to_order

API to add number in a campaign,by assiging it to an existing order_id whose status is either in progress or pending.

Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/call-center/add_call_to_order"

payload = "{\n  \"order_id\":19xxxx88, \n  \"phone_numbers\":\"+9191xxxxx66\", \n  \"call_times_retry\":3, \n  \"retry_timedelta\":1 \n}"
headers = {
    'authorization': "5508exxxxxxxxxxxxxxxx874a97e612",
    'x-api-key': "NRMxxxxxxxxxxxxxiVH768rxsDMlo",
    'content-type': "application/json",
    }

response = requests.request("PUT", url, data=payload, headers=headers)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/call-center/add_call_to_order",
  "method": "PUT",
  "headers": {
    "authorization": "5508ed2xxxxxxxxxx874a97e612",
    "x-api-key": "NRMPGxxxxxxxxxxxH768rxsDMlo",
    "content-type": "application/json",
  },
  "processData": false,
  "data": "{\n  \"order_id\":19xxx488, \n  \"phone_numbers\":\"+91xxxx69466\", \n  \"call_times_retry\":3, \n  \"retry_timedelta\":1 \n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

PHP :

 "https://kpi.knowlarity.com/Basic/v1/account/call-center/add_call_to_order",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{\n  \"order_id\":19xxxxx88, \n  \"phone_numbers\":\"+9xxxxxx9466\", \n  \"call_times_retry\":3, \n  \"retry_timedelta\":1 \n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: 550xxxxxxxxxxxxx7e612",
    "content-type: application/json",
    "x-api-key: NRMPGExxxxxxxxxxxxxxxxxxxxxxxxxxxxsDMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
{
  "order_id":1xxx488, 
  "phone_numbers":"+9191xxxxx466", 
  "call_times_retry":3, 
  "retry_timedelta":1 
}
Sample Response
{
  "result": "call added successfully"
  "status_code":1
}

Get Circle API

GET
/{channel}/v1/account/numbers/Circle

Lists out all the circle ids against a telco-circle. Optional. If want to get circles for of the provided country. If not provided then it will pick the country from your account setting

Body Description

Parameter Data Type Required Description
country String No Australia
Austria
Belgium
Brazil
Canada
France
Germany
India
Liechtenstein
Luxembourg
Malaysia
Monaco
Netherlands
New Zealand
Nigeria
Philippines
Singapore
South Africa
Switzerland
Thailand
Turkey
UK
United Arab Emirates
US
Western Europe
Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/numbers/Circle"

headers = {
    'authorization': "XXXXXX-XXXXX-XXXX-XXXXXX",
    'x-api-key': "XXXXXXXXXXXXXXXXXXXXXXXXXXX",
    }

response = requests.request("GET", url, headers=headers)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/numbers/Circle",
  "method": "GET",
  "headers": {
    "authorization": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX",
    "x-api-key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
PHP :

 "https://kpi.knowlarity.com/Basic/v1/account/numbers/Circle",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: "XXXXXXX-XXXX-XXXX-XXXXXXXX",
    "x-api-key: XXXXXXXXXXXXXXXXXXXXXXXXXXX"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}


Request body
Request body
Header:  
    x-api-key: APPLICATION ACCESS KEY
    Authorization:SR_API_KEY
Path:
    channel: Basic
QueryParameter:
    country:country available in list
Sample Response
Success: 200
[
{
city: "Andhra Pradesh",
id: 3
}
]

Error: 401
{
message: "The SR API Key used to authenticate is incorrect."
}

Error: 400
{
message: "You have provided invalid country name. For more information contact support."
}

Get plans API

GET
/{channel}/account/plans

Lists out all the plan details associated with an account

Body Description

Parameter Data Type Required Description
id String No Id of the userplan
plan String No Plan of the user
plan_type String No E(Enterprise), D(demo), P(paid),I(internal), T(international), H(Channel partner), C(Complementary)
Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/plans"

headers = {
    'authorization': "XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX",
    'x-api-key': "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)
Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/plans",
  "method": "GET",
  "headers": {
    "authorization": "XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX",
    "x-api-key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

PHP :

 "https://kpi.knowlarity.com/Basic/v1/account/plans",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX",
    "x-api-key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}


Request body
Header:  
    x-api-key: APPLICATION ACCESS KEY
    Authorization: USERNAME:SR_API_KEY
    content-type : application/json
Path:
    channel: Basic,Advance,Premium,Enterprise
Sample Response
Status code: 200
{
meta: {
limit: 1000,
next: "",
offset: 0,
previous: "",
total_count: 3
},
objects: [
{
userplan_id: 407890,
plan_name: "Premium",
is_active: "false",
created_date: "2016-10-20 14:53:34+00:00",
expiry_time: "2017-10-19 18:30:00+00:00",
plan_type: "I"
}]}

Status code: 401
{
error: "The SR API Key used to authenticate is incorrect."
}

Get Available number API

GET
/{channel}/v1/account/numbers/AvailablePhoneNumbers

Lists out all the available phone numbers in the telco-circles

Body Description

Parameter Data Type Required Description
circle_id Integer Yes Id of the circle of which you want the available number list. You can get the circle id using the Get Circle API
cli_type Integer No If you want the outgoing number to set as caller id while doing C2C pass the cli_type in parameter giving the value as 1 and no need to pass if you want incoming number.
number_rating Integer No If one wants to see all star rating numbers then provide -1 as value
Number rating is defined in 0 to 5, default value is 0 and categorizes as Platinum - 5, Diamond - 4, Gold - 3, Silver - 2, Fancy - 1, Regular - 0
number_type String No Number type can be mobile, landline, tollfree
pattern String No You can define pattern of number in 3 ways - starts with, contains, and ends with. For starts with, use ^ followed by the number, example %5E%2B919069, where %5E is for ^ and %2B for +. For contains simply pass the number like 9069. For ends with pass the number followed with $, for example 8967%24 where %24 is for $
Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/numbers/AvailablePhoneNumbers"

querystring = {"circle_id":"1"}

headers = {
    'authorization': "XXXXXXX-XXXX-XXXX-XXXXXXXXXX",
    'x-api-key': "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    }

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/numbers/AvailablePhoneNumbers?circle_id=1",
  "method": "GET",
  "headers": {
    "authorization": "XXXXXX-XXXX-XXXX-XXXXXXXXXXXXXX",
    "x-api-key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
PHP :

 "https://kpi.knowlarity.com/Basic/v1/account/numbers/AvailablePhoneNumbers?circle_id=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: XXXXXXX-XXXXXX-XXX-XXXXXXX",
    "x-api-key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
Header:  
    x-api-key: APPLICATION ACCESS KEY
    Authorization: USERNAME:SR_API_KEY
    content-type : application/json
Path:
    channel: Basic
Sample Response
Status code: 200
{
numbers: [
{
number_type: "MOBILE",
number_rating: 0,
circle_id: 1,
number: "+91XXXXXXXX",
provider_name: "Vodafone"
}
]
}

Status code: 401
{
message: "The SR API Key used to authenticate is incorrect."
}


Status code: 400
{
message: "Provide some input. For more information contact support."
}
or
{
message: "You have provided incorrect input. For more information contact support."
}

Buy the available numbers API

POST
/{channel}/v1/account/numbers

Allocate the available phone numbers in the telco-circles for a particular plan id with an expiry time

Body Description

Parameter Data Type Required Description
user_plan_id String Yes user_plan_id you get from account_info get API
expiry_time String Yes Expiry time of the number it should be greater than current time and less than or equal to the plan expiry time
number String Yes number you want to allocate get from the AvailablePhoneNumbers API
cli_type String No Required if you want to allocate cli number. In this case its value will be 'OUTGOING'
Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/numbers"

payload = "{\"user_plan_id\":\"XXXX\",\n\"expiry_time\":\"2017-04-25 00:00:00\",\n\"number\":\"+91XXXXXXXXXX\"\n}"
headers = {
    'authorization': "XXXXXX-XXXX-XXXX-XXXXXXX",
    'content-type': "application/json",
    'x-api-key': "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/numbers",
  "method": "POST",
  "headers": {
    "authorization": "XXXXXX-XXXX-XXXX-XXXXXXX",
    "content-type": "application/json",
    "x-api-key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  },
  "processData": false,
  "data": "{\"user_plan_id\":\"XXXX\",\n\"expiry_time\":\"2017-04-25 00:00:00\",\n\"number\":\"+91XXXXXXXXXX\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

PHP :
 "https://kpi.knowlarity.com/Basic/v1/account/numbers",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"user_plan_id\":\"XXXX\",\n\"expiry_time\":\"2017-04-25 00:00:00\",\n\"number\":\"+91XXXXXXXXXX\"\n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: XXXXXX-XXXX-XXXX-XXXXXXX"
    "content-type: application/json",
    "x-api-key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
Header:
    x-api-key: APPLICATION ACCESS KEY
    Authorization: SR_API_KEY
    content-type : application/json

Path:
    channel: Basic

Request Body:
{
user_plan_id:407890,
expiry_time:"2017-04-25 00:00:00",
number:"+91XXXXXXXXXX"
}
Sample Response
Status code: 200
{
message:"Your provided number has been allocated to you Successfully",
Number:phone_number
}

Status code: 401
{
message: "The SR API Key used to authenticate is incorrect."
}

Status code: 400
{
   "message": "You have provided incorrect input. For more information contact support."
}

Sound API

The Sound API is an important tool to upload and list sound under an account.
Once the developer upload a sound it goes under approval process. Then Knowlarity's support team authorize the sound on the basis of the content and mark it as "Approved" or "Rejected".
The developer can use only approved sound in the campaigns.

Using Sound API the developer can:

  1. 1. Upload a sound file
  2. 2. List all the sound files.

Phonebook API

This API allows developers upload phonebook which they can use in campaign API.

This API includes:

  1. 1. Uploading of phonebook
  2. 2. Listing of uploaded phonebook

Get Phonebook API

GET
/{channel}/v1/account/contacts/phonebook/

Get list of phonebooks associated with the SR account.

Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/contacts/phonebook/"

headers = {
    'authorization': "046XXXXXXXXXXXXXXXXXXXXXXXXXXXX301",
    'x-api-key': "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    'cache-control': "no-cache"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/contacts/phonebook/",
  "method": "GET",
  "headers": {
    "authorization": "046XXXXXXXXXXXXXXXXXXXXXXXXXXXX301",
    "x-api-key": "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    "cache-control": "no-cache"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

PHP :


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/contacts/phonebook/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: 046XXXXXXXXXXXXXXXXXXXXXXXXXXXX301",
    "cache-control: no-cache",
    "x-api-key: NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Sample Response
{
  "meta": {
    "limit": 1000,
    "next": "",
    "offset": 0,
    "previous": "",
    "total_count": 1
  },
  "objects": [
    {
      "description": "",
      "duplicates_count": 0,
      "id": 1,
      "invalid_count": 0,
      "ndnc_count": 0,
      "phonebookfile": "https://xyz.com/phonebook_1.csv",
      "phonebookname": "phonebook_1",
      "row_count": 2,
      "timestamp": "Thu, 30 Mar 2017 18:24:24 +0530"
    }
  ]
}

Post Phonebook API

POST
/{channel}/v1/account/contacts/phonebook/

Upload a phonebook in associated SR account.

Example
Python :

import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/contacts/phonebook"

payload = "{\n\"phonebookname\":\"phonebook_1\",\n\"numbers\":\"+91XXXXXXXXXX;+91XXXXXXXXXX\"\n}\n"
headers = {
    'authorization': "046XXXXXXXXXXXXXXXXXXXXXXXXXX301",
    'x-api-key': "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    'content-type': "application/json",
    'cache-control': "no-cache",
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/contacts/phonebook",
  "method": "POST",
  "headers": {
    "authorization": "046XXXXXXXXXXXXXXXXXXXXXXXXXX301",
    "x-api-key": "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    "content-type": "application/json",
    "cache-control": "no-cache",
  },
  "processData": false,
  "data": "{\n\"phonebookname\":\"phonebook_1\",\n\"numbers\":\"+91XXXXXXXXXX;+91XXXXXXXXXX\"\n}\n"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

PHP :

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/contacts/phonebook",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\"phonebookname\":\"phonebook_1\",\n\"numbers\":\"+91XXXXXXXXXX;+91XXXXXXXXXX\"\n}\n",
  CURLOPT_HTTPHEADER => array(
    "authorization: 046XXXXXXXXXXXXXXXXXXXXXXXXXX301",
    "cache-control: no-cache",
    "content-type: application/json",
    "x-api-key: NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}


Request body
{
    "phonebookname":"phonebook_1",
    "numbers":"+91XXXXXXXXX;+91XXXXXXXXXX"
}
Sample Response
{
  "msg": [
    "Successfully added phonebook"
  ],
  "id": 1
}

Get Sound API

GET
/{channel}/v1/account/sound

Get list of sounds associated with the SR account.

Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/sound"

headers = {
    'authorization': "046XXXXXXXXXXXXXXXXXXXXXXXXXXX301",
    'x-api-key': "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    'cache-control': "no-cache",
    }

response = requests.request("GET", url, headers=headers)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/sound",
  "method": "GET",
  "headers": {
    "authorization": "046XXXXXXXXXXXXXXXXXXXXXXXXXXX301",
    "x-api-key": "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    "cache-control": "no-cache",
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


PHP :


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/sound",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: 046XXXXXXXXXXXXXXXXXXXXXXXXXXX301",
    "cache-control: no-cache",
    "x-api-key: NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Sample Response
Status_code - 200
{
  "meta": {
    "limit": 1000,
    "next": "",
    "offset": 0,
    "previous": "",
    "total_count": 1
  },
  "objects": [
    {
      "comment": "",
      "date": "Fri, 1 Jul 2016 16:45:37 +0530",
      "description": "",
      "id": "1",
      "language": "english",
      "soundfile": "https://xyz.com/test.mp3",
      "soundname": "test.mp3",
      "status": "1"
    }
  ]
}

Agent API

This API allows developers to handle agent-related customizations. This powerful API has many uses, including but not limited to defining factors for call routing, providing role-based access rights and tracking agent work schedules. It helps manage the users in a contact center solution.
Agent Details - In order to create an agent, you must enter correct values for name, phone number and email address. This will help generate a unique ID for each agent in your account.
Role - This attribute assigns hierarchical roles to the agents in the account. Supervisors and Agents have different levels of access in the account and the agent API allows you to set the correct access level for every agent.
Status - This attribute gives us the availability of an agent to receive a call. In addition, this helps keep a track of agent performance.
Call Groups - This attribute allows segmentation of users based on their teams. The call groups can be defined based on your team structure and this information can be utilized while deciding the call flow.

Post Sound API

POST
/{channel}/v1/account/sound

Upload sound to the associated SR account.

After uploading sound, user will get it's status as '0' which means the sound is under approval process which is done by Knowlarity's support team.
Status description -
Under Approval : '0'
Approved : '1'
Rejected : '2'

Parameter Data Type Description
soundname string Name of the sound file
soundfile string Public url of the sound file and it should be in mp3 or wav format
language string Optional:Language of the sound
description string Optional:Description of the sound
Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/sound/"

payload = "{\n    \"soundname\":\"test\",\n    \"soundfile\":\"https://XXXXXXXXXXXXXXXXXXXX.mp3\",\n    \"description\":\"test\",\n    \"language\":\"eng\"\n    \n}\n\n\n"
headers = {
    'authorization': "046XXXXXXXXXXXXXXXXXXXXXX301",
    'x-api-key': "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    'content-type': "application/json",
    'cache-control': "no-cache",
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

Javascript :

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/sound/",
  "method": "POST",
  "headers": {
    "authorization": "046XXXXXXXXXXXXXXXXXXXXXX301",
    "x-api-key": "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    "content-type": "application/json",
    "cache-control": "no-cache",
  },
  "processData": false,
  "data": "{\n    \"soundname\":\"test\",\n    \"soundfile\":\"https://XXXXXXXXXXXXXXXXXXXX.mp3\",\n    \"description\":\"test\",\n    \"language\":\"eng\"\n    \n}\n\n\n"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
PHP :

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/sound/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n    \"soundname\":\"test\",\n    \"soundfile\":\"https://XXXXXXXXXXXXXXXXXXXX.mp3\",\n    \"description\":\"test\",\n    \"language\":\"eng\"\n    \n}\n\n\n",
  CURLOPT_HTTPHEADER => array(
    "authorization: 046XXXXXXXXXXXXXXXXXXXXXX301",
    "cache-control: no-cache",
    "content-type: application/json",
    "x-api-key: NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
{
  "soundname": "test",
  "soundfile": "https://xyz.com/sound.mp3",
  "language": "English",
  "description": "Testing"
}
Sample Response
{
  "msg": [
    "Successfully added sound"
  ],
  "status": "0",
  "id": 157777
}

Call Logs API

The Call Log API is an important tool to track and measure the calls under an account.
The developer can fetch the following information using call logs API:

  1. 1. Multiple call logs under an account using filters like recordings, agent name & call dates.
  2. 2. A specific call log using the call log ID.

Call logs API also allows pagination resulting in a user-friendly view, while fetching multiple records under one account.
Call logs API enables the developer to keep detailed records of calls, call type, caller details, agent details, waiting time, total talk-time etc.
These APIs, in addition to providing the basics of a call, also prove to be a powerful asset when it comes to call-level analysis and overall sanitization of contact center solutions.

Get Campaign API

GET
/{channel}/v1/account/call/campaign

List out all the campaigns created via the SR account.

Filters Description

Parameter Data Type Description
order_id string Id of the campaign created
created_time__gte string created time of the order greater than equal to given time
created_time__lte string created time of the order less than equal to given time
end_time__gt string end time of the order greater than the given value
end_time__gte string end time of the order greater than equal to the given value
end_time__lt string end time of order less than the given value
end_time__lte string end time of order less than equal to the given value
is_transactional string if transactional provide "True" and if promotional provide "False"
ivr_id string ivr id
phonebook_id string phonebook id
start_time__gt string start time of the order greater than the given value
start_time__gte string start time of the order greater than equal to the given value
start_time__lt string start time of order less than the given value
start_time__lte string start time of order less than equal to the given value
Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/call/campaign"

querystring = {"start_time__gt":"2017-04-10","start_time__lt":"2017-04-12"}

headers = {
    'authorization': "046XXXXXXXXXXXXXXXXXXXXXXXX301",
    'x-api-key': "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    'cache-control': "no-cache",
    }

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)

Javascript :

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/call/campaign?start_time__gt=2017-04-10&start_time__lt=2017-04-12",
  "method": "GET",
  "headers": {
    "authorization": "046XXXXXXXXXXXXXXXXXXXXXXXX301",
    "x-api-key": "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    "cache-control": "no-cache",
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
PHP :

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/call/campaign?start_time__gt=2017-04-10&start_time__lt=2017-04-12",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "authorization: 046XXXXXXXXXXXXXXXXXXXXXXXX301",
    "cache-control: no-cache",
    "x-api-key: NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Sample Response
{
  "meta": {
    "limit": 1000,
    "next": "",
    "offset": 0,
    "previous": "",
    "total_count": 1
  },
  "objects": [
    {
      "additional_number": "+91XXXXXXXXXX",
      "call_scheduling": "[1, 1, 1, 1, 1, 0, 0]",
      "call_scheduling_start_time": "09:00:00 +0530",
      "call_scheduling_stop_time": "21:00:00 +0530",
      "caller_id": "",
      "created_time": "Tue, 11 Apr 2017 14:19:37 +0530",
      "end_time": "",
      "is_transactional": "False",
      "ivr": "sound_obd_ivr_1",
      "ivr_id": "1",
      "ndnc_count": 0,
      "optin_key": "",
      "order_id": "170",
      "order_status": "Pending",
      "order_throttling": "0/10",
      "phonebook_id": "",
      "priority": 1,
      "retry_duration": 15,
      "start_time": "Tue, 11 Apr 2017 15:55:00 +0530",
      "max_retry": 3,
      "timezone": "Asia/Kolkata",
      "total_calls": 1
    }
  ]
}

Post Campaign API

POST
/{channel}/v1/account/call/campaign

API to create a campaign

Body Description

Parameter Data Type Required Description
sound_id/ivr_id Integer Yes Id of the approved sound or Ivr
phonebook String No Id of the phonebook. It will be required if user is not passing any additional_number
timezone String Yes Timezone in which user want to place campaign
priority Integer No The value should be in between 1 and 10
order_throttling Integer No Maximum parallel calls
retry_duration Integer No Duration (in mins) between two retries
max_retry Integer No Number of retries if a call fails
start_time string Yes Start time of the order and it should be in the format yyyy-MM-dd HH:mm
end_time string No End time of the order and it should be in the format yyyy-MM-dd HH:mm
call_scheduling string No Weekdays on which user want to schedule the campaign.Representing it in array format like "[1, 1, 1, 1, 1, 0, 0]" starting from monday to sunday, 1 if user want to schedule the call on the day and 0 otherwise.
call_scheduling_start_time string No Campaign start time per day. Default is 9:00
call_scheduling_stop_time string No Campaign stop time per day. Default is 21:00
k_number string Yes SR number of Enterprise Plan
additional_number string No Numbers on which user want to run the campaign. Required if phonebook is not provided
is_transactional string No Value will be "True"/"False", and if the value is True then transactional campaign will be created otherwise promotional and default value is False.
Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/call/campaign"

payload = "{\"sound_id\":1,\n\"phonebook\":1,\n\"timezone\":\"Asia/Kolkata\",\n\"priority\":1,\n\"order_throttling\":10,\n\"retry_duration\":15,\n\"max_retry\":1,\n\"start_time\":\"2017-04-11 18:26\",\n\"call_scheduling\":\"[1, 1, 1, 1, 1, 0, 0]\",\n\"call_scheduling_start_time\":\"9:00\",\n\"call_scheduling_stop_time\":\"21:00\",\n\"k_number\":\"+91XXXXXXXXXX\",\n\"additional_number\":\"\"\n}"
headers = {
    'authorization': "046XXXXXXXXXXXXXXXXXXXX301",
    'x-api-key': "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    'content-type': "application/json",
    'cache-control': "no-cache",
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/call/campaign",
  "method": "POST",
  "headers": {
    "authorization": "046XXXXXXXXXXXXXXXXXXXX301",
    "x-api-key": "NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo",
    "content-type": "application/json",
    "cache-control": "no-cache",
  },
  "processData": false,
  "data": "{\"sound_id\":1,\n\"phonebook\":1,\n\"timezone\":\"Asia/Kolkata\",\n\"priority\":1,\n\"order_throttling\":10,\n\"retry_duration\":15,\n\"max_retry\":1,\n\"start_time\":\"2017-04-11 18:26\",\n\"call_scheduling\":\"[1, 1, 1, 1, 1, 0, 0]\",\n\"call_scheduling_start_time\":\"9:00\",\n\"call_scheduling_stop_time\":\"21:00\",\n\"k_number\":\"+91XXXXXXXXXX\",\n\"additional_number\":\"\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

PHP :

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/call/campaign",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"sound_id\":1,\n\"phonebook\":1,\n\"timezone\":\"Asia/Kolkata\",\n\"priority\":1,\n\"order_throttling\":10,\n\"retry_duration\":15,\n\"max_retry\":1,\n\"start_time\":\"2017-04-11 18:26\",\n\"call_scheduling\":\"[1, 1, 1, 1, 1, 0, 0]\",\n\"call_scheduling_start_time\":\"9:00\",\n\"call_scheduling_stop_time\":\"21:00\",\n\"k_number\":\"+91XXXXXXXXXX\",\n\"additional_number\":\"\"\n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: 046XXXXXXXXXXXXXXXXXXXX301",
    "content-type: application/json"
    "x-api-key: NRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}


Request body
{
  "sound_id": 1,
  "phonebook": 1,
  "timezone": "Asia/Kolkata",
  "priority": 10,
  "order_throttling": 10,
  "retry_duration": 15,
  "start_time": "2017-01-01 00:00",
  "max_retry": 1,
  "call_scheduling": "[1, 1, 1, 1, 1, 0, 0]",
  "call_scheduling_start_time": "09:00",
  "call_scheduling_stop_time": "21:00",
  "k_number": "+91XXXXXXXXXX",
  "additional_number": "+91XXXXXXXX;+91XXXXXXXX"
}
Sample Response
{
  "order_id": 175,
  "result": "placed order successfully",
  "status_code": 1
}

PUT Campaign API

PUT
/{channel}/v1/account/call/campaign

API to control the campaign.

Status can be pause, resume and stop

Example
Python :

import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/call/campaign/1xx"

payload = "{\n  \"status\": \"stop\"\n}"
headers = {
    'authorization': "046ccxxxxxxxxxxxxxxx20e9301",
    'x-api-key': "NRMxxxxxxxxxxxxxxxxxH768rxsDMlo",
    'cache-control': "no-cache",
    }

response = requests.request("PUT", url, data=payload, headers=headers)

print(response.text)


Javascript :

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/Basic/v1/account/call/campaign/1xx",
  "method": "PUT",
  "headers": {
    "authorization": "046ccxxxxxxxxxxxxxxxx0e9301",
    "x-api-key": "NRMPGExxxxxxxxxxxxxxx0iT4iVH768rxsDMlo",
    "cache-control": "no-cache",
  },
  "data": "{\n  \"status\": \"stop\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

PHP :

 "https://kpi.knowlarity.com/Basic/v1/account/call/campaign/123",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{\n  \"status\": \"stop\"\n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: 04xxxxxxxxxxx9301",
    "cache-control: no-cache",
    "x-api-key: NRxxxxxxxxxxxxxxxxxxxMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
{
	"status":"pause"
}
Sample Response
Success - 200
{
  "message": "Campaign paused successfully!"
}

Campaign Add Number

POST
/{channel}/v1/account/call/campaign/add-numbers

API to add number in a campaign whose status is either in progress or pending.

Notes - sivr_call_ids in response is the set of call ids generated by product and used for all retry attempts of a call.

Example
Python :
import requests

url = "https://kpi.knowlarity.com/test/v1/account/call/campaign/add-numbers/"

payload = "{\n\t\"order_id\":178,\n\t\"phone_numbers\":\"+9170xxxx0689\"\n}"
headers = {
    'authorization': "046ccxxxxxxxxxxxxxx67cf20e9301",
    'x-api-key': "NRMxxxxxxxxxxxxxxxxxxxxH768rxsDMlo",
    'content-type': "application/json"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

Javascript :
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://kpi.knowlarity.com/test/v1/account/call/campaign/add-numbers/",
  "method": "POST",
  "headers": {
    "authorization": "046cc3f4-xxxxxxxxxxxxxxxxxx67cf20e9301",
    "x-api-key": "NRMPxxxxxxxxxxxxxxxxxxxiT48rxsDMlo",
    "content-type": "application/json"
  },
  "processData": false,
  "data": "{\n\t\"order_id\":178,\n\t\"phone_numbers\":\"+917xxxxxx0689\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

PHP :


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/test/v1/account/call/campaign/add-numbers/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"order_id\":178,\n\t\"phone_numbers\":\"+9170xxxxx0689\"\n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: 046ccxxxxxxxxxxxxxxx-067cf20e9301",
    "content-type: application/json",
    "x-api-key: NRMPxxxxxxxxxxxxxxxx4iVH768rxsDMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
{
  "order_id": 0,
  "additional_number": "+91XXXXXXXX;+91XXXXXXXX"
}
Sample Response
{
  "dnd_count": "0",
  "message": "call added successfully"
  "sivr_call_ids":[]
}

Tasks API

SuperReceptionist’s first aim is to help businesses so that they never lose a lead. We understand how important every lead is and we have a simple solution to deal with the problem of missing out on leads - generating Follow-up Tasks for any missed or deferred calls using the Tasks API.
This API is especially useful to capture leads for the calls received during a missed call campaign. Once the list of callers has been identified via call logs API, the Tasks API allows the calls to be assigned to agents with specific due-dates.
This also means that agents can schedule reminders for follow-up calls to customers, thus plan their work more efficiently. Inputs like creation time, due date, status etc. are highly useful in analyzing agent-performances and in planning for high call volumes.

Contacts API

An important aspect of any contact centre solution is the information capturing mechanism or the CRM. Using Contact APIs, the developer can store and retrieve customer details. Results can be filtered using attributes like status, phone number, email address etc. You can also assign a status to the customers, edit their details etc.
You can also customize your searches. For eg. Finding out how many calls someone with the status ‘Hot’ made in the last month, all you would need to do is query all ‘Hot’ leads using Contacts API and then use Call-log APIs to get the logs of those callers.

Call API

Call APIs are used to make outbound calls. These APIs can be used in two ways:

1. Dedicated one-to-one calls between two numbers (Click-to-Call)
2. Running outbound campaign to multiple numbers at the same time (K-Broadcast)

While making multiple calls, the developer can do a plethora of customizations. Some of them are:

    - defining call timings,
    - setting priority while running multiple campaigns,
    - scheduling the time,
    - starting, pausing or stopping a campaign,
    - adding phone numbers to a live campaign,
    - selecting the number of concurrent calls to be made by the system
    - defining the nature of a campaign - Transactional or Promotional - based on regulatory permitting limitations.**
    - Getting a list of ongoing campaigns with their real-time status.

In short, call API helps you save manual intervention and organize communication for you like never before.
**Please be noted that Transactional campaigns are not allowed by default due to legal restrictions set by TRAI. If you wish to avail this feature, please get in touch with our support team to help you get the required clearance.

Notifications API

Notification APIs allow your SuperReceptionist number to receive notifications about any live calls. Using this API, developers can build highly verbose applications (eg. two users connected in a call can be notified about the status of the call).
The API uses a streaming API that generates various events (refer table below) which can be monitored by developers. Each event has a different call status (eg. ORIGINATE_AGENT_CALL, which means the call has been originated from the SuperReceptionist web panel to the agent’s number).
The developer can also set specific actions for each of these events (eg. For all HANGUP statuses, the developer can send a "Thank You" message).
This API facilitates the development of an interactive application, thereby leads to improvement in user experience and better relationship with customers.

Get Agents List

GET
/{channel}/v1/account/agent

Fetches list of agents for a given SR Account.

Request body
Header:  
    x-api-key: USERNAME:APPLICATION ACCESS KEY
    Authorization: SR_API_KEY
    content-type : application/json
Path:
    channel: Basic,Advance,Premium,Enterprise
Sample Response
Success 200:
[
  {
    "agent_status": "Available",
    "call_groups": [],
    "callcenter_role": "owner",
    "first_name": "prashanth",
    "id": "6xx793",
    "last_name": "N"
  },
  {
    "agent_status": "Logged Out",
    "call_groups": [],
    "callcenter_role": "agent",
    "first_name": "Shivam",
    "id": "7xx283",
    "last_name": ""
  }]

Get Agent Detail

GET
/{channel}/v1/account/agent/{id}

This API call fetches the details of an agent.

Request body
Header:  
    x-api-key: USERNAME:APPLICATION ACCESS KEY
    Authorization: SR_API_KEY
    content-type : application/json
Path:
    channel: Basic,Advance,Premium,Enterprise
Sample Response
Success 200:
{
  "agent_status": "Available",
  "call_groups": [
    "-"
  ],
  "callcenter_role": "owner",
  "first_name": "prashanth",
  "id": "615793",
  "last_name": "N"
}

Get Call Logs

GET
https://kpi.knowlarity.com{channel}/v1/call/

Fetches all call logs matching the given filters

Request Parameters

Parameter Data Type Description
call_type Boolean Direction of the call, 1 for outgoing and 0 for incoming
agent_number String The agent to whom the call landed
knowlarity_number String Knowlarity SuperReceptionist Number Eg. +91XXXXXXXXXX
start_time (Mandatory) Timestamp Call Start Time from which the logs need to be fetched (in YYYY-MM-DD hh:mm:ss format)
end_time (Mandatory) Timestamp Call Start Time till which the logs need to be fetched (in YYYY-MM-DD hh:mm:ss format)
business_call_type string The call actions defined for the SuperReceptionist number, can be any of - Voicemail, Call, Phone, Fax, Conference, DTMF, Sound, Blacklist, Queue
customer_number string Caller's Phone number Eg. +91XXXXXXXXXX
limit Integer Count of call logs to be fetched

Response Fields

Parameter Data Type Description
customer_number String Caller's Phone number Eg. +91XXXXXXXXXX
uuid String DB id of the Call log
agent_number String The agent to whom the call landed Eg. +91XXXXXXXXXX
call_duration String Duration for which the call was active (in seconds)
business_call_type String The call action defined for this call, could be any of - Voicemail, Call, Phone, Fax, Conference, DTMF, Sound, Blacklist, Queue
id integer Call log number fetched
call_type Boolean Direction of the call, 1 for outgoing and 0 for incoming
call_recording URI Location where the Call Recording is saved
knowlarity_number String Knowlarity SuperReceptionist Number Eg. +91XXXXXXXXXX
start_time Timestamp Time when this call was initiated (in YYYY-MM-DD hh:mm:ss format)
timezone_offset String Default timezone set for this SuperReceptionist account
Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/calllog"

payload = ""
headers = {
    'channel': "Basic",
    'x-api-key': "NRMPGEBxxxxxxxxxx7sa5xxxxxVH768rxsDMlo",
    'authorization': "046cc3f4xxxxxxxxxx7sa5xxxxxcf20e9301",
    'content-type': "application/json",
    'start_time': "2017-03-13 12:00:00+05:30",
    'end_time': "2017-03-14 12:00:00+05:30",
    'cache-control': "no-cache",
    }

response = requests.request("GET", url, data=payload, headers=headers)

print(response.text)
Javascript :
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "kpi.knowlarity.com",
  "port": null,
  "path": "/Basic/v1/account/calllog",
  "headers": {
    "channel": "Basic",
    "x-api-key": "NRMPGEBxxxxxxxxxx7sa5xxxxxH768rxsDMlo",
    "authorization": "046cc3xxxxxxxxxx7sa5xxxxx7cf20e9301",
    "content-type": "application/json",
    "start_time": "2017-03-13 12:00:00+05:30",
    "end_time": "2017-03-14 12:00:00+05:30",
    "cache-control": "no-cache",
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
PHP :

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/calllog",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "authorization: 046cc3xxxxxxxxxx7sa5xxxxxcf20e9301",
    "cache-control: no-cache",
    "channel: Basic",
    "content-type: application/json",
    "end_time: 2017-03-14 12:00:00+05:30",
    "start_time: 2017-03-13 12:00:00+05:30",
    "x-api-key: NRMPGExxxxxxxxxx7sa5xxxxxH768rxsDMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
Header:  
    x-api-key: APPLICATION ACCESS KEY
    Authorization: USERNAME:SR_API_KEY
    content-type : application/json
Path:
    channel: Basic,Advance,Premium,Enterprise
Sample Response
Success 200:
{
  "meta": {
    "limit": "",
    "next": "",
    "offset": "",
    "previous": "",
    "total_count": ""
  },
  "objects": [
    {
      "caller_id": "+91XXXXXXXXXX",
      "uuid": "3a89a4e8-4a9d-4916-84f5-f0cdc9b3ac81",
      "destination": "Call Missed",
      "call_duration": 0,
      "business_call_type": "Phone",
      "id": 143047040,
      "Call_Type": false,
      "resource_uri": "",
      "dispnumber": "+91XXXXXXXXXX",
      "start_time": "2016-05-05 06:14:13+00:00"
    },
    {
      "caller_id": "+91XXXXXXXXXX",
      "uuid": "c4062316-316d-4cd1-b7ff-a780bcf27e05",
      "destination": "+91XXXXXXXXXX",
      "call_duration": 239,
      "business_call_type": "Phone",
      "id": 143058611,
      "Call_Type": false,
      "resource_uri": "http://kservices.knowlarity.com/kstorage/read?uuid=c4062316-316d-4cd1-b7ff-a780bcf27e05_1_r.mp3&server_ip=182.71.101.206&base_dir=recording",
      "dispnumber": "+91XXXXXXXXXX",
      "start_time": "2016-05-05 06:43:47+00:00"
    }
]
}

Get Task List

GET
/{channel}/v1/account/tasks

Get List of tasks associated with SR Account.

Example
Javascript
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "kpi.knowlarity.com",
  "port": null,
  "path": "/Basic/v1/account/tasks",
  "headers": {
    "channel": "Basic",
    "x-api-key": "NRMPGxxxxxxxxxx7sa5xxxxxH768rxsDMlo",
    "authorization": "046ccxxxxxxxxxx7sa5xxxxx0e9301",
    "content-type": "application/json",
    "cache-control": "no-cache",
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
Python

import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/tasks"

payload = ""
headers = {
    'channel': "Basic",
    'x-api-key': "NRMPGEBxxxxxxxxxx7sa5xxxxx68rxsDMlo",
    'authorization': "046cxxxxxxxxxx7sa5xxxxxcf20e9301",
    'content-type': "application/json",
    'cache-control': "no-cache",
    }

response = requests.request("GET", url, data=payload, headers=headers)

print(response.text)
PHP



$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/tasks",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "authorization: 046cc3xxxxxxxxxx7sa5xxxxx7cf20e9301",
    "cache-control: no-cache",
    "channel: Basic",
    "content-type: application/json",
    "x-api-key: NRMPGEBxxxxxxxxxx7sa5xxxxxVH768rxsDMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
Header:  
    x-api-key: APPLICATION ACCESS KEY
    Authorization: USERNAME:SR_API_KEY
    content-type : application/json
Path:
    channel: Basic,Advance,Premium,Enterprise
Sample Response
Success 200:
{
  "meta": {
    "limit": 1000,
    "next": "",
    "offset": "0",
    "previous": "",
    "total_count": "11"
  },
  "objects": [
    {
      "agent_id": "",
      "call_missed_dt": "2016-06-17 16:18:21+00:00",
      "callrecord_uuid": "0a4b6122-a48d-4d17-b40d-f4d9b267c5b9",
      "completed_dt": "$None",
      "completed_via": "",
      "duedate": "",
      "contact_id": "",
      "created_by": "internal",
      "created_dt": "2016-06-17 16:18:21+00:00",
      "id": 4369999,
      "is_completed": false,
      "modified_dt": "2016-06-17 16:18:21+00:00",
      "phone": "+261206350631",
      "type": "missedcall"
    }
]
}

Get Task Detail

GET
/{channel}/v1/account/tasks/{id}

Fetch a specific Task under an account

Example
Python :
import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/tasks/4591040"

payload = ""
headers = {
    'channel': "Basic",
    'x-api-key': "NRMPGxxxxxxxxxx7sa5xxxxxxsDMlo",
    'authorization': "046cxxxxxxxxxx7sa5xxxxx0e9301",
    'content-type': "application/json",
    'cache-control': "no-cache",
    }

response = requests.request("GET", url, data=payload, headers=headers)

print(response.text)

Javascript :
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "kpi.knowlarity.com",
  "port": null,
  "path": "/Basic/v1/account/tasks/4591040",
  "headers": {
    "channel": "Basic",
    "x-api-key": "NRMPGEBxxxxxxxxxx7sa5xxxxxVH768rxsDMlo",
    "authorization": "046cc3xxxxxxxxxx7sa5xxxxx20e9301",
    "content-type": "application/json",
    "cache-control": "no-cache",
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


PHP :



$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/tasks/4591040",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "authorization: 046cc3f4xxxxxxxxxx7sa5xxxxxf20e9301",
    "cache-control: no-cache",
    "channel: Basic",
    "content-type: application/json",
    "x-api-key: NRMPGEB9xxxxxxxxxx7sa5xxxxxH768rxsDMlo"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
Header:  
    x-api-key: APPLICATION ACCESS KEY
    Authorization: USERNAME:SR_API_KEY
    content-type : application/json
Path:
    channel: Basic,Advance,Premium,Enterprise
Sample Response
Success 200:
{
  "agent_id": "",
  "call_missed_dt": "2016-06-17 16:18:21+00:00",
  "callrecord_uuid": "0a4b6122-a48d-4d17-b40d-f4d9b267c5b9",
  "completed_dt": "$None",
  "completed_via": "",
  "duedate": "",
  "contact_id": "",
  "created_by": "internal",
  "created_dt": "2016-06-17 16:18:21+00:00",
  "id": 4369999,
  "is_completed": false,
  "modified_dt": "2016-06-17 16:18:21+00:00",
  "phone": "+261206350631",
  "type": "missedcall"
}

Make Outbound Call

POST
https://kpi.knowlarity.com/{channel}/v1/account/call/makecall

Establish a call between two numbers (Agent and Customer). The first call is placed to agent number, and it is then connects with the customer. In the event where an agent misses the call, no call is placed to the customer number.
Note -

  • To use the Make Call API, you need to register your SupreReceptionist number for receiving notifications from our Streaming API. On how to do this, please refer the Notifications API section on this page.
  • If you are getting message that 'Agent Number not register with SR account' then check in your SR account -> settings -> plan settings, whether you have enabled 'Allowed agents Only', if yes then add the agent number there.
  • caller_id field is optional.

Request body
Header:  
    x-api-key: APPLICATION ACCESS KEY
    Authorization: SR_API_KEY
    content-type : application/json
Path:
    channel: Basic,Advance,Premium,Enterprise

Request Body:
    {
        "k_number": "+919069118xxx",
        "agent_number": "+919069118xxx",
        "customer_number": "+918861037xxx"
    }
Sample Response
Success: 200 OK
    {
        "success": {
        "status": "success",
         "message": "Call successfully placed"
         }
    }

Error:
    {
        "error": {
         "message": "Call Failed! Number 9876543210 in Do Not Call registry."
        }
    }
    or
    {
        "error": { 
        "message": "Invalid API Key for this SR number"}
    }

Enable/Disable Notifications

PUT
https://kpi.knowlarity.com/{channel}/v1/account/notifications

Enable/Disable an Existing registered integration.

Example
Python :

import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/notifications"

payload = "\n{\n \"knowlarity_number\": \"+91906xxx1811\",\n \"enable\": \"enable\"\n}\n"
headers = {
    'channel': "Basic",
    'x-api-key': "mxoX4520Ih5xxxxxxxxxx7sa5xxxxx5QdC79PP",
    'authorization': "84239xxxxxxxxxx7sa5xxxxx66beb27a027",
    'content-type': "application/json",
    'cache-control': "no-cache",
    }

response = requests.request("PUT", url, data=payload, headers=headers)

print(response.text)

Javascript :

var http = require("https");

var options = {
  "method": "PUT",
  "hostname": "kpi.knowlarity.com",
  "port": null,
  "path": "/Basic/v1/account/notifications",
  "headers": {
    "channel": "Basic",
    "x-api-key": "mxoX4520Ih5xxxxxxxxxxx7sa5xxxxxQdC79PP",
    "authorization": "842393dd-bd14-11e6-9504-066beb27a027",
    "content-type": "application/json",
    "cache-control": "no-cache",
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ knowlarity_number: '+91906xxx41811', enable: 'enable' }));
req.end();

PHP :

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/notifications",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "\n{\n \"knowlarity_number\": \"+9190xxxx811\",\n \"enable\": \"enable\"\n}\n",
  CURLOPT_HTTPHEADER => array(
    "authorization: 8423xxxxxxxxxx7sa5xxxxxb27a027",
    "cache-control: no-cache",
    "channel: Basic",
    "content-type: application/json",
    "x-api-key: mxoX4520xxxxxxxxxx7sa5xxxxxQdC79PP"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
Header:  
    x-api-key: APPLICATION ACCESS KEY
    Authorization: SR_API_KEY
    content-type : application/json
Path:
    channel: Basic,Advance,Premium,Enterprise
   
    {
        "knowlarity_number": "+919069118xxx",
        "enable": "enable"
    } 
Sample Response
Success: 200
    {
       "message": "Successfully enabled."
    }
   or
    {
      "message": "Successfully disabled."
    }
Error: 401 Unauthorized
   {
      "message": "Client name, authorization or knowlarity number is wrong.
   }

Register for Notifications

POST
https://kpi.knowlarity.com/{channel}/v1/account/notifications

Register your SuperReceptionist number to start receiving live call notifications (Streaming API) for all incoming and outgoing calls.

Example
Python :

import requests

url = "https://kpi.knowlarity.com/Basic/v1/account/notifications"

payload = "\n{\n \"knowlarity_number\": [\n   \"+91XXXXXXXXXX\"\n ]\n}"
headers = {
    'channel': "Basic",
    'x-api-key': "mxoX452xxxxxxxxxxxxx7Jsa5xxxxx9PP",
    'authorization': "842393ddxxxxxxxxxx7Jsa5xxxxx6beb27a027",
    'content-type': "application/json",
    'cache-control': "no-cache",
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

Javascript :

var http = require("https");

var options = {
  "method": "POST",
  "hostname": "kpi.knowlarity.com",
  "port": null,
  "path": "/Basic/v1/account/notifications",
  "headers": {
    "channel": "Basic",
    "x-api-key": "mxoX4520Ih5xxxxxxxxxx7Jsa5xxxxxZAq67Jsa5QdC79PP",
    "authorization": "842393xxxxxxxxxx7Jsa5xxxxx9504-066beb27a027",
    "content-type": "application/json",
    "cache-control": "no-cache",
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ knowlarity_number: [ '+9190xxxx1811' ] }));
req.end();

PHP :

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/notifications",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "\n{\n \"knowlarity_number\": [\n   \"+9190xxxx1811\"\n ]\n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: 842393xxxxxxxxxx7Jsa5xxxxx-066beb27a027",
    "cache-control: no-cache",
    "channel: Basic",
    "content-type: application/json",
    "x-api-key: mxoX4520Ixxxxxxxxxx7sa5xxxxxjCZAq67Jsa5QdC79PP"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Request body
Header:  
    x-api-key: APPLICATION ACCESS KEY
    Authorization: SR_API_KEY
    content-type : application/json
Path:
    channel: Basic,Advance,Premium,Enterprise
Request Body (raw JSON)
    {
        "knowlarity_number": ["+91906911XXXX"]
     }
Sample Response
Success: 200
    { 
       "message": "Successfully registered."
    }
Error: 400: bad request
    {
        "error": {
                         "knowlarity_number": "The knowlarity number(+91XXXXXXXXXX) or API key is invalid."
                   }
    }

Notifications (Streaming API)

GET
https://konnect.knowlarity.com:8100/update-stream/{SR_API_KEY}/konnect

Summary: Receive live call notifications for your registered SuperReceptionist number. Please see event descriptions above.

Computer-Telephony Integration (CTI)

SuperReceptionist provides CTI APIs for seamlessly integrating our cloud telephony with other applications. These APIs adds a lot to the agent's ability to respond to callers efficiently. At a minimum, these telephony events can be consumed to show relevant information on the agent's workstation whenever a call is delivered to the agent via telephone. A typical CTI application manages the event flow that is generated by the telephony API during the life cycle of a call. This typically proceeds along the following sequence:




Term Meaning
Agent SuperReceptionist account owner or their employee(s) who will receive incoming calls to the SuperReceptionist number or make outbound calls to customers.
Customer SuperReceptionist account owner's customers who are calling the SuperReceptionist number or receiving calls from it.
Events/Notifications For each incoming/outgoing call, SuperReceptionist will generate notifications to inform what is happening with the call. These notifications can be used to display browser popups for incoming calls with the caller details, create call logs in the CRM etc.

The event data is in JSON format and has the following fields.

Field Description
call_direction Type of the call. It will be Inbound or Outbound.
business_call_type The value can be:
  • Inbound: Your Customer Call was connected with the agent.
  • Unanswered: No Agent was available to accept customer call (Inbound).
  • Customer didn't answer the call.(Outbound) 
  • Outbound: Agent Call Connected with the Customer.
  • Missed call: Your knowlarity knowlarity number got a miss call from customer.
agent_number Agent's number.
call_recording An URL to the audio file which contains the conversation between customer and agent. This URL will be available in bridge call for the event type 'HANGUP'.
uuid It is an UUID number to uniquely identify the call.
customer_number Your customer's phone number. For event type AGENT_CALL and AGENT_ANSWER, this field value will be null.
knowlarity_number Your knowlarity number.
k_number Your knowlarity number (deprecated).
event Type of the event. It can be:
  • ORIGINATE
  • AGENT_CALL
  • AGENT_ANSWER
  • CUSTOMER_CALL
  • CUSTOMER_ANSWER
  • BRIDGE
  • HANGUP
application, called, k_api_key Optional fields, should be ignored.

CDR event data:

 
    { 
        "business_call_type": "Unanswered",
        "agent_number": "+91XXXXXXXXXX",
        "call_recording": null,
    ,   "call_type": null,
        "uuid": "40eec284206dtf6d2d0e503c9877f9",
        "customer_number": "+91XXXXXXXXXX",
        "knowlarity_number": "+91XXXXXXXXXX",
        "event_type": "ORIGINATE",
        "called": "81XXXXXXXX"
    }

Call Detail Record (CDR) event is generated at the end of a call after the agent/customer hangs up. Event fields are different from the actual telephony events and they described are below.

Field Description
Call_Type "Incoming" or "Outgoing"
call_duration Number of seconds from call launching to hangup
caller_id Phone number of the agent(Outgoing) or customer (Incoming)
destination Phone number of the customer(Outgoing) or agent (Incoming)
start_time Start time of the telephone call
end_time End time of the telephone call
dispnumber SR Number or Virtual number purchased from Knowlarity
resource_url Call recording link if there is bridged conversation
timezone_offset The additional offset used to calculate UTC
uuid It is an UUID number to uniquely identify the call.
   
type CDR
business_call_type The values can be:
  1. "Phone"
  2. "Agent Missed"
  3. "Customer Missed"
  4. "Voicemail"
  5. "DTMF"
  6. "Missed Call"
  7. "Conference"
  8. "Blacklist"
  9. "Sound"
  10. "Fax"
  11. "OutGoing Calls"

An example of CDR data can be like:

{
   "dispnumber" : "+91XXXXXXXXXX",
   "business_call_type" : "Phone",
   "caller_id" : "+91XXXXXXXXXX",
   "Call_Type" : "Incoming",
   "start_time" : "2015-11-20 11:50:18+05:30",
   "uuid" : "129ac15d-d8b4-499e-92e1-83317d1745df",
   "call_duration" : 29,
   "destination" : "+91XXXXXXXXXX",
   "end_time" : "2015-11-20 11:51:37.868542+05:30",
   "resource_url" : "http://kservices.knowlarity.com/kstorage/read?uuid=6cd3bc78-3181-4e7d-aacf-daac580601a9_0_1_r.mp3&server_ip=124.7.51.154&base_dir=recording",
   "type" : "CDR",
   "timezone_offset" : "+0530"
}

Note: Please observe that for general events keyword for type is "event_type" and for CDR it is just "type".

Example
Python :
import requests
import sys
import traceback
while True:
    try:
        r = requests.get('https://konnect.knowlarity.com:8100/update-stream/{SR_API_KEY}/konnect',stream=True)
        print r.status_code
        if r.status_code == 200:
            print 'Connection Open'
            for line in r.iter_lines():
                if line:
                    print line
        else:
            print r.status_code, r.text
            break
    except KeyboardInterrupt:
        sys.exit()
    except:
        traceback.format_exc()
        print 'Connection Closed'
        continue
Javascript :
URL = "https://konnect.knowlarity.com:8100/update-stream/{SR_API_KEY}/konnect"
source = new EventSource(URL);
source.onmessage = function (event) {
	var data = JSON.parse(event.data)
	console.log('Received an event .......');
	console.log(data);
}
Curl :
curl --get 'https://konnect.knowlarity.com:8100/update-stream/{SR_API_KEY}/konnect' --verbose

Request body
Path Parameter: SR_API_KEY
No Body Required.   
Sample Response
Stream events data in Json Format:

List Registrations

GET
https://kpi.knowlarity.com/{channel}/v1/account/notifications

List of SuperReceptionist number registered for notifications.

Example
Python :
import requests
import json

url = "https://kpi.knowlarity.com/Basic/v1/account/notifications"

payload = ""
headers = {
    'channel': "Basic",
    'x-api-key': "mxoX452xxxxxxxxxx7sa5xxxxx7Jsa5QdC79PP",
    'authorization': "842393dd-bd14-11e6-9504-066beb27a027",
    'content-type': "application/json",
    'cache-control': "no-cache",
    }

response = requests.request("GET", url, data=payload, headers=headers)

json_data = response.json()
#print(response.text)

Javascript :

var http = require("https");

var options = {
  "method": "GET",
  "hostname": "kpi.knowlarity.com",
  "port": null,
  "path": "/Basic/v1/account/notifications",
  "headers": {
    "channel": "Basic",
    "x-api-key": "mxoX4520Ixxxxxxxxxx7sa5xxxxxq67Jsa5QdC79PP",
    "authorization": "842393dd-bd14-11e6-9504-066beb27a027",
    "content-type": "application/json",
    "cache-control": "no-cache",
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();

PHP :


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://kpi.knowlarity.com/Basic/v1/account/notifications",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "authorization: 842393xxxxxxxxxx7sa5xxxxx66beb27a027",
    "cache-control: no-cache",
    "channel: Basic",
    "content-type: application/json",
    "x-api-key: mxoX4520xxxxxxxxxx7sa5xxxxx67Jsa5QdC79PP"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);
echo $response;
curl_close($curl);

Request body
Header:  
    x-api-key: APPLICATION ACCESS KEY
    Authorization: SR_API_KEY
    content-type : application/json
Path:
    channel: Basic,Advance,Premium,Enterprise
Request Body (raw JSON)
    No Body required.

Query Params: 
    knowlarity_number: Filter results using knowlarity number.
    enabled: Filter results using True or False.
Sample Response
Response 200:
    {
      "meta": {
        "limit": 20,
        "next": null,
        "offset": 0,
        "previous": null,
        "total_count": 1
      },
      "objects": [
        {
          "app_api_key": "",
          "app_data": "{"username":"admin","password":"passsme"}",
          "app_type": {
            "id": x,
            "name": "SUGXXXCRM",
            "resource_uri": "/api/v1/applications/x"
          },
          "app_url": "http://10.60.8.57/suitecrm/service/v4_1/rest.php",
          "date_updated": "2015-08-06T12:33:56",
          "enable": false,
          "expired": false,
          "id": xxx,
          "k_api_key": "15e4xxxxxxxxxxxx1e4-bead-22000aaca33c",
          "k_number": "+9190xxxxxxx780",
          "k_number_cc": "IN",
          "konnect_api_client": null,
          "product": "SR",
          "resource_uri": "/api/v1/integrations/xxx",
          "user": {
            "id": xx,
            "resource_uri": "/api/v1/users/xx",
            "username": "SR"
          }
        },]
    }