A tariff is a price list: a currency, per-call parameters such as connect fee and grace period, and a set of rates. These methods manage the tariff itself, the same as the Tariffs screen of the panel. To read its rates, see List the rates of a tariff .
All methods support trusted mode with i_customer.
createTariff and updateTariff take these fields, and getTariffInfo returns them. Required applies to createTariff.
Name
Type
Required
Description
name
string
yes
Tariff Name
currency
string
yes
Currency of every rate, ISO 4217. Fixed after creation
i_tariff_type
int
no
Type : 1 Tariff for outgoing calls (default), 2 Incoming Tariff for DID calls. Fixed after creation. Dictionary tariff_types
connect_fee
double
no
Connect Fee per connected call, in the tariff currency. Default 0
free_seconds
int
no
Free Seconds . Default 0
post_call_surcharge
double
no
Post Call Surcharge, % as a fraction: 0.05 adds 5%. Default 0
grace_period
int
no
Grace Period, sec : shorter calls are free on rates with grace period on. Default 0
loss_protection
boolean
no
Enable Loss Protection . Default False
max_loss
double
no
Max Loss, % as a fraction: 0.1 allows 10%. Used with loss_protection
cost_round_up
boolean
no
Calls Cost : True for Round-Up , False (default) for Round
decimal_precision
int
no
Cost Decimal Precision : decimals kept for the cost of each call. Default 20
average_duration
int
no
Avg. Call Duration, sec , used to compare route costs. Default 200
local_calling
boolean
no
Local calling Enabled : area-based prices on the rates. Default False
local_calling_cli_validation_rule
string
no
CLI Validation Rule that decides from the caller’s number whether a call is local
Creates a tariff without rates.
The fields of the tariff structure .
Name
Type
Description
result
string
OK
i_tariff
int
ID of the new tariff
{ " result " : " OK " , " i_tariff " : 12 }
Changes a tariff. Fields you leave out keep their values. currency and i_tariff_type cannot be changed.
Name
Type
Required
Description
i_tariff
int
yes
ID of the tariff
other fields
no
Any field of the tariff structure
Name
Type
Description
result
string
OK
call ( " updateTariff " , { " i_tariff " : 12 , " connect_fee " : 0.01 , " grace_period " : 3 } )
Deletes a tariff with its rates.
Name
Type
Required
Description
i_tariff
int
yes
ID of the tariff
Name
Type
Description
result
string
OK
call ( " deleteTariff " , { " i_tariff " : 12 } )
Returns one tariff.
Name
Type
Required
Description
i_tariff
int
yes
ID of the tariff
call ( " getTariffInfo " , { " i_tariff " : 12 } )
Returns your tariffs.
Name
Type
Required
Description
name_pattern
string
no
Filter by tariff name
limit
int
no
Return at most this many tariffs
offset
int
no
Skip this many tariffs first
Name
Type
Description
result
string
OK
tariffs
array
One struct per tariff with i_tariff, name, currency and i_tariff_type
call ( " getTariffsList " , { " name_pattern " : " Wholesale USD " } )
{ " i_tariff " : 12 , " name " : " Wholesale USD " , " currency " : " USD " , " i_tariff_type " : 1 },