JSON API » plans » plans/create

Creates a new rate plan.

Input parameters

Requires authentication and the commerce role privilege.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
nameStringName.Yes
auto_topupDecimalThe balance to top up to when doing an automatic topup.No0.00
bill_deferInteger1 to defer billing of features until start of next billing period, 0 not to.No0
bill_typeStringBilling type. "external", "none", "prepaid", "prepaid_invoices", "prepaid_calls", or "postpaid".No"prepaid"
bulk_callsIntegerMaximum concurrent bulk dialler calls. -1 for default limit.No-1
call_maximumDecimalMaximum spending on calls per customer per day. -1 for no limit.No-1
callerid_in_externalInteger1 to pass callerid from inbound external calls to telephone lines, 0 not to.No1
carry_forward_messagesInteger1 to carry forward unused messages for one billing period, 0 not to.No0
carry_forward_secondsInteger1 to carry forward unused call seconds for one billing period, 0 not to.No0
conference_callsIntegerMaximum concurrent conference calls. -1 for no limit.No-1
contractStringMinimum contract length. "1_month", "3_month", "6_month", "1_year", "18_month", "2_year", "3_year", or empty string for none.NoEmpty string.
cos_timegroupIntegerID of time group for class of service. 0 for none.No0
currencyStringCurrency costs are in.NoSystem currency.
customerIntegerID of customer to create in.NoCustomer of authentication user.
descriptionStringDescription.NoEmpty string.
dialplanStringDial plan for the rate plan. Empty string for default.NoEmpty string
external_outInteger1 to allow external calls by default, 0 not to.No1
huntgroup_destsIntegerMaximum destinations per hunt group. -1 for no limit.No-1
included_messagesIntegerNumber of messages included free each billing period.No0
included_secondsIntegerNumber of calls seconds included free each billing period.No0
inconnect_marginDecimalProfit margin to add to inbound connect fee after markup.No0.00
inconnect_markupIntegerPercentage markup on inbound connect fee.No0
incost_marginDecimalProfit margin to add to inbound per-minute cost after markup.No0.00
incost_markupIntegerPercentage markup on inbound per-minute cost.No0
inheritableInteger1 to allow resellers to inherit their plans from this plan, 0 not to.No0
inmaximumIntegerMaximum concurrent inbound calls. -1 for no limit.No-1
inmessage_marginDecimalProfit margin to add to inbound messages after markup.No0.00
inmessage_markupIntegerPercentage markup on inbound messages.No0
internal_outInteger1 to allow internal calls by default, 0 not to.No1
invoicesStringWhether to send invoices. "customer", "parent", "queue", or empty string for no invoices.No"customer"
invoices_dueIntegerThe number of days after issue that invoices become due. 0 for immediate. -1 for manual.No0
invoices_overdueIntegerThe number of days after invoices become due that they become overdue. -1 for manual.No-1
invoice_detailStringWhat detail to include on invoices. "summary", "transactions", "cdrs", "direction_cdrs", "group_cdrs", "source_cdrs", "group_transactions", "group_transactions_cdrs", "group_transactions_direction_cdrs", "group_transactions_group_cdrs", "group_transactions_source_cdrs", "transactions_cdrs", "transactions_direction_cdrs", "transactions_group_cdrs", or "transactions_source_cdrs".No"transactions_cdrs"
invoice_formatStringFormat invoices are sent in. "pdf" or "xml".No"pdf"
low_balanceDecimalThe balance to trigger an automatic topup at.No0.00
maxmsgIntegerMaximum messages per mailbox.No1000
maxsecsIntegerMaximum message duration in seconds.No300
outconnect_marginDecimalProfit margin to add to outbound connect fee after markup.No0.00
outconnect_markupIntegerPercentage markup on outbound connect fee.No0
outcost_marginDecimalProfit margin to add to outbound per-minute cost after markup.No0.00
outcost_markupIntegerPercentage markup on outbound per-minute cost.No0
outmaximumIntegerMaximum concurrent outbound calls. -1 for no limit.No-1
outmessage_marginDecimalProfit margin to add to outbound messages after markup.No0.00
outmessage_markupIntegerPercentage markup on outbound messages.No0
overmaxInteger1 to allow customers to go over maximum calls, 0 to reject calls.No0
pagegroup_destsIntegerMaximum destinations per page group. -1 for no limit.No-1
parentIntegerID the plan inherits settings from. 0 for no parent.No0
payment_typeStringPayment type on signup. "creditcard", "direct_debit", "external", or "none".No"creditcard"
peer1IntegerID of peer to send all outbound calls to. 0 to use routing exceptions.No0
periodStringBilling period. "daily", "weekly", "monthly", "2_monthly", "3_monthly", "6_monthly", "annually", or empty string for indefinite.No"monthly"
period_startStringWhen the billing period starts. "start" or "exact".No"start"
person_roleIntegerID of the first person's role on signup.No0
purge_messagesStringWhen to purge mailbox messages. "1_day", "1_week", "1_month", "3_months", "6_months", "1_year", or empty string for never.NoEmpty string.
queue_callsIntegerMaximum concurrent queue calls. -1 for no limit.No-1
queue_destsIntegerMaximum destinations per queue. -1 for no limit.No-1
record_maximumIntegerMaximum number of seconds of recordings to keep. -1 for unlimited.No-1
require_tax_numberInteger1 to require tax number in signup, 0 not to.No0
roundingIntegerNumber of digits to round call prices to, from 0 to 6.No6
service_call_lockedInteger1 to forward calls to customer service if customer is locked, 0 not to.No0
service_copyInteger1 to copy customer service on emails to customers, 0 not to.No0
service_emailStringCustomer service email address. Empty string for none.NoEmpty string.
service_telephoneStringCustomer service telephone number. Empty string for none.NoEmpty string.
signup_topupInteger1 to attempt to topup the customer's account on signup. 0 not to.No0
sharedIntegerWhether the plan is shared. "resellers", "resellers_recursive", or empty string not to share.NoEmpty string.
totalmaximumIntegerMaximum concurrent total calls. -1 for no limit.No-1
use_markupsInteger1 to use markups, 0 to reject calls if this plan has no matching cost exception.No1
validationInteger1 to validate input then return, 0 for full action.No0

Responses

CodeDescription
200Success.
201Input passed validation. Only returned if validation=1.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.
403Your rate plan does not allow this.

Data returned

The ID of the created rate plan.

Example: With required parameters

http://enswitch.example.com/api/json/plans/create/?auth_username=user;auth_password=password;name=example

{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }

Change history

VersionChanges
3.15invoice_detail parameter updated to include grouped transactions. maxsecs input parameter added.
3.14inconnect, incost, inmessage, outconnect, outcost, and outmessage input parameters renamed to inconnect_markup, incost_markup, inmessage_markup, outconnect_markup, outcost_markup, and outmessage_markup. bulk_calls, conference_calls, huntgroup_dests, inconnect_margin, incost_margin, inmessage_margin, outconnect_margin, outcost_margin, outmessage_margin, pagegroup_dests, queue_calls, and queue_dests input parameters added.
3.13Function added.