The call rates and call types API lets integrators list, read and create call rate cards (the per-call-type prices applied to a customer) and read the call type definitions those rate cards are built on.
Base URL: https://billing.pracbill.com.au/api/:tokenid/...
GET /:tokenid/callRates/get/page/:pageReturn a paged list of call rate cards.
| Parameter | Type | Required | Description |
|---|---|---|---|
tokenid |
string | Yes | Your API access token. |
page |
integer | Yes | Page number, starting at 1. |
Request
curl --location --request GET 'https://billing.pracbill.com.au/api/9742f34b-f83a-4ab6-a375-dbfe8e2ddd0a/callRates/get/page/1'
Response
{
"results": [
{
"id": 226,
"name": "Default Rates",
"billing_increment": 60
},
{
"id": 1124,
"name": "Binary Networks",
"billing_increment": 1
],
"page_number": "1",
"total_pages": 1
}
GET /:tokenid/callRates/get/:idReturn further details about a call rate card, including its list of call type rates.
| Parameter | Type | Required | Description |
|---|---|---|---|
tokenid |
string | Yes | Your API access token. |
id |
integer | Yes | Call rates ID (ctgid). |
Request
curl --location --request GET 'https://billing.pracbill.com.au/api/892f86d5-da86-4e98-9343-1976a375/callRates/get/226'
Response (success)
{
"success": true,
"callRates": {
"ctgid": 226,
"name": "Default Rates",
"active": 1,
"billing_increment": 60,
"date_created": "2017-12-05 08:32:10",
"date_modified": "2017-12-05 08:32:10",
"user_created": 50,
"user_modified": 50,
"tags": "",
"international_markup_percent": 0,
"callTypes": [
{
"id": 15,
"ctgid": 226,
"ctid": 70,
"fixedrate": 1,
"ratepermin": 0,
"flagfall": 0,
"min_cost": 0,
"max_cost": 0,
"free_seconds": 0,
"name": "1800 Local Call - Inbound 1800",
"min_callpackusage": -1,
"max_callpackusage": -1,
"date_created": "2017-08-23 15:45:59",
"date_modified": "2020-01-23 20:47:38",
"user_created": 50,
"user_modified": 50,
"internal_code": "1800l",
"direction": "inbound"
},
{
"id": 16,
"ctgid": 226,
"ctid": 65,
"fixedrate": 1,
"ratepermin": 0,
"flagfall": 0,
"min_cost": 0,
"max_cost": 0,
"free_seconds": 0,
"name": "Free Calls",
"min_callpackusage": -1,
"max_callpackusage": -1,
"date_created": "2017-08-23 15:45:59",
"date_modified": "2020-01-23 20:47:38",
"user_created": 50,
"user_modified": 50,
"internal_code": "f",
"direction": "outbound"
}
]
}
}
Response (error)
{"success":false,"description":"serviceType not found"}
All amounts are listed ex tax in dollars, i.e. 10c = 0.10.
| Field | Type | Notes |
|---|---|---|
ctgid |
integer | ID of Call Rates |
name |
string | Name of Call Rates |
active |
integer/boolean 0/1 | Whether this is active ( inactive rates are removed from the search/list ) |
billing_increment |
integer (nullable) or 0 for default | How many second increments to bill in ( common 60 ( 1 min ), 30 ( half a min ) 1 (per second) ) |
tags |
string | A collection of tags to group these rates by |
international_markup_percent |
integer (nullable) or 0 for default | percentage to do default international call prices markup |
callTypes |
array ( of rates [object] ) | this is a list of call rates for this rate card |
date_created |
datetime | Date Created |
date_modified |
datetime | Date Modified |
| Field | Type | Notes |
|---|---|---|
ctid |
integer | ID of call type |
fixedrate |
integer/boolean 0/1 | whether this is a flat call rate, or per minute charging |
ratepermin |
float | per minute rate |
flagfall |
float | call connection cost |
min_cost |
float | minimum call cost |
max_cost |
float | maximum call cost |
free_seconds |
integer | number of free seconds to include before starting the ratepermin |
name |
string | human readable call type name |
min_callpackusage |
float | minimum amount to deduct from a call pack ( -1 means no limit, 0 means no deductions apply ) |
max_callpackusage |
float | maximum amount to deduct from a call pack ( -1 means no limit, 0 means no deductions apply ) |
internal_code |
string | internal rate code for the call type |
direction |
string | call direction for this call type |
POST /:tokenid/callRates/postCreate or update call rates. The body is a JSON object using the same fields as the Get call rates response.
Please note that the only required field is the ctid in the callTypes array; the rest of the fields in the post are optional, and default values will be used if nothing is passed in.
| Parameter | Type | Required | Description |
|---|---|---|---|
tokenid |
string | Yes | Your API access token. |
name |
string | No | Name of Call Rates |
active |
integer/boolean 0/1 | No | Whether this is active |
billing_increment |
integer | No | How many second increments to bill in |
tags |
string | No | A collection of tags to group these rates by |
international_markup_percent |
integer | No | percentage to do default international call prices markup |
callTypes |
array of object | No | List of call type rates; each takes the Call types fields above |
callTypes[].ctid |
integer | Yes | ID of call type |
Request
curl --location --request POST 'https://billing.pracbill.com.au/api/bf8c6695-4e75-458a-ab27-93103358b08f/callRates/post' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Custom Rates",
"active": 1,
"billing_increment": 30,
"tags": "",
"international_markup_percent": 0,
"callTypes": [
{
"ctid": 201,
"fixedrate": 0,
"ratepermin": 0.1,
"flagfall": 0.01,
"min_cost": 0.02,
"max_cost": 0.03,
"free_seconds": 4,
"min_callpackusage": -1,
"max_callpackusage": -1
},
{
"ctid": 202,
"fixedrate": 1,
"ratepermin": 0.2,
"flagfall": 0,
"min_cost": 0,
"max_cost": 0,
"free_seconds": 0,
"min_callpackusage": -1,
"max_callpackusage": -1
}
]
}'
Response (success)
{
"success": true,
"ctgid": 130
}
Response (error)
{
"success": false,
"message": "The requested data was empty ignoring"
}
This error message occurs from one of the following conditions:
GET /:tokenid/serviceType/get/page/:pageReturn a paged list of call types (service types).
| Parameter | Type | Required | Description |
|---|---|---|---|
tokenid |
string | Yes | Your API access token. |
page |
integer | Yes | Page number, starting at 1. |
Request
$.ajax({
url: '/api/892f86d5-da86-4e98-9343-1976a375/serviceType/get/page/1',
type: 'GET',
contentType: 'application/json',
success: function( response ) {
console.log(response);
}
});
Response
{
"results": [
{
"ctid": "123",
"name": "Mobile Call",
"internal_code": "mobile",
"direction": "outbound",
"priority": "3",
"application": ""
},
],
"page_number": "1",
"total_pages": 1
}
GET /:tokenid/callType/get/:idReturn further details about a call type (service type), including its default rate.
The legacy documentation gives the URI as
/:tokenid/callType/get/:idbut the example calls/serviceType/get/123. Both are shown here as documented; see the checklist.
| Parameter | Type | Required | Description |
|---|---|---|---|
tokenid |
string | Yes | Your API access token. |
id |
integer | Yes | Call type ID (ctid). |
Request
$.ajax({
url: '/api/892f86d5-da86-4e98-9343-1976a375/serviceType/get/123',
type: 'GET',
contentType: 'application/json',
success: function( response ) {
console.log(response);
}
});
Response (success)
{
"success": true,
"serviceType": {
"ctid": "123",
"internal_code": "mobile",
"pabx_code": "mobile",
"name": "Mobile Call",
"date_created": "2019-01-31 08:21:09",
"date_modified": "2019-04-02 11:53:35",
"user_created": "99",
"user_modified": "99",
"direction": "mobile",
"clid_regex": ".*",
"dest_regex": "^614",
"tags": "",
"application": "",
"enid_fields": "accountcode,callerid",
"validation_function": "",
"account_regex": ".*",
"priority": "3",
"default_rate": {
"id": "1000",
"ctgid": "5",
"ctid": "123",
"fixedrate": "0",
"ratepermin": "0.1500",
"flagfall": "0.0000",
"min_cost": "0.1500",
"max_cost": "0.0000",
"free_seconds": "0",
"name": "",
"min_callpackusage": "-1.0000",
"max_callpackusage": "-1.0000",
"date_created": "2019-03-05 17:16:54",
"date_modified": "2020-09-23 09:39:32",
}
}
Response (error)
{"success":false,"description":"serviceType not found"}
| Field | Type | Notes |
|---|---|---|
ctid |
integer | ID of call type |
internal_code |
string | Rate Code or internal code for the call type |
pabx_code |
string | internal code, used very infrequently, for specific integrations |
name |
string | Human/Public name of the call type |
direction |
string | either inbound or outbound to define which call direction is to be billed |
clid_regex |
string(regex) | a regex string to define the caller id matching pattern ( PCRE ) |
dest_regex |
string(regex) | a regex string to define the destination matching pattern ( PCRE ) |
tags |
string | a list of tags to group call types by |
application |
string | must match this application string in the cdr |
enid_fields |
list( comma separated strings ) | a list of fields to match for billable entity |
validation_function |
string | an internal validation function to confirm this call type is a match |
account_regex |
string(regex) | a regex string to define the accountcode matching pattern ( PCRE ) |
priority |
int | a numerical priority to match the call type on, higher is a greater is match |
default_rate |
object | defined below |
date_created |
datetime | Date Created |
date_modified |
datetime | Date Modified |
| Field | Type | Notes |
|---|---|---|
id |
integer | ID of Call Rate Item |
ctgid |
int | Call Rate Group ID |
ctid |
int | Call Type ID |
fixedrate |
boolean | Is this a fixed rate or per minute rate |
ratepermin |
float | the ex tax rate per minute |
flagfall |
float | the ex tax rate to apply on call connection |
min_cost |
float | minimum cost to apply to a call |
free_seconds |
int | number of seconds to not allow for free, before the per minute rate starts |
name |
string | human readable name for this specific call rate |
min_callpackusage |
float | if -1 it is ignored, or else if call packs are enabled, ensure that this is the minimum amount charged |
max_callpackusage |
float | if -1 it is ignored, or else if call packs are enabled, ensure that this is the maximum amount charged |
account_regex |
string(regex) | a regex string to define the accountcode matching pattern ( PCRE ) |
date_created |
datetime | Date Created |
date_modified |
datetime | Date Modified |
Related: Getting started with the API, API overview, CDR API, Services API, Pricing API.