Numbers & call routing
Number Blocking
Number Blocking stops calls before they are placed or delivered, with two kinds of rules. Destination rules block a whole call class of the account's rate plan (a country, a number range or a service type, identified by a dial-prefix mask) for some or all extensions; they are the /v2/calls-block-unblock family and need an account admin. Blocked numbers block one phone number, inbound and/or outbound, for the whole account; they are /v3/number-blocking. The neighbouring Blacklist Numbers group is not about calls: it is the messaging block list, described at the end of this guide.
Workflow (what the portal does)
- Destination rules:
GET /v2/calls-block-unblockwithpageandperPage(both required;perPageis 15, 25, 50, 100 or -1),sort(nameby default,-namefor descending),filter[sSearch](a substring of the destination name or of its prefix mask) andextension(comma-separated extension numbers; the status of each destination is then computed for those extensions only, otherwise for every extension of the account). The answer is DataTables-shaped:aaData[]rows withclass_id(one or more comma-separated destination ids that share a name),class_name,class_mask(the dialled-prefix pattern, such as^00) andblocked, which is1when blocked for every extension considered,0when allowed and-1when blocked for some of them;iTotalRecordsandiTotalDisplayRecordscarry the total. - Block or unblock:
POST /v2/calls-block-unblockwithaction(0to block,1to unblock),extensions(comma-separated extension numbers, each of which must exist on the account) anddestinations(comma-separatedclass_idvalues from the list; pass a row's wholeclass_idstring). Both are optional and the four combinations differ: both filled applies the action to those destinations for those extensions;destinationsalone to those destinations for every extension;extensionsalone to every destination for those extensions; neither to every destination for every extension, that is, block all or unblock all. The answer is204; read the list again to see the resulting status. - Copy rules between extensions is a portal action (Call Blocking → Copy rules); through the API, create the same rules on each extension.
- Blocked numbers:
GET /v3/number-blockingwithpageandperPage(both required; 15, 25, 50 or 100),filter[search](a substring of the number or of the notes) andsort(phone_numberby default,inbound,outboundornotes,-for descending). A standard paginated answer:data[]rows of{"entry_id", "phone_number", "inbound", "outbound", "notes"}withlinksandmeta(total,per_page,current_page,last_page). - Add a blocked number:
POST /v3/number-blockingwithphone_number(up to 20 characters, unique within the account),inboundandoutbound(booleans: refuse calls from the number, refuse calls to it) and optionalnotes. The answer is204with no body: list again to learn theentry_id. - Edit or remove:
PUT /v3/number-blocking/{entryId}takes the same fields as the create (phone_numberis required again; a flag you leave out keeps its value) andDELETE /v3/number-blocking/{entryId}removes the entry. Both answer204; an id that does not belong to the account answers404.
Blacklist Numbers
The Blacklist Numbers group is the account's messaging block list, not a call rule: a number on it is never sent an SMS, MMS or WhatsApp message by the account. A send to it is created with status 4 (failed), error_code BLOCKED and the description Recipient is blocked or opted out (see Conversations), and the number shows sms_blocked: true on a contact's phones in Contacts. Calls are not affected; use the blocked numbers above for that. GET /v3/blacklist-numbers lists the manually blocked numbers as {"id", "mobile_number", "account", "status", "notes", "entrydate"}; POST /v3/blacklist-numbers with mobile_number (up to 20 characters) and optional notes (up to 50) answers 201 with the row, or 204 when it was already blocked; GET /v3/blacklist-numbers/{mobileNumber} answers the row, or 204 when the number is not blocked; DELETE /v3/blacklist-numbers/{mobileNumber} unblocks it (204). status is 2 for a number blocked through this endpoint and 3 for a number that opted out of the account's messages; only 2 rows are listed, shown and deleted here, but both stop sends, and a POST for an opted-out number turns it into a 2 row.
Roles and access
- The destination rules (list, block or unblock) need an account admin; other users get
403. - Blocked numbers (
/v3/number-blocking) and the blacklist (/v3/blacklist-numbers) are open to any authenticated user of the account.
Pitfalls
actionis the opposite of what the name suggests:0blocks,1unblocks.- There is no
allkeyword on the block call:extensions=allanswers422withOne or more extensions are invalid., anddestinationshas no such value either. Leave the field out, or send it empty, to mean "all". blockedin the list is an integer, not a boolean, and-1(partially blocked) appears whenever only some of the extensions considered are blocked. Passextensionto get the answer for specific extensions.- A row's
class_idcan hold several ids (12,13). Send that whole string indestinations; the ids grouped under one name are one destination to the portal. - Both lists require
pageandperPage(422without them); an unknownfilter[...]orsortanswers400. The/v3/number-blockinglist has no-1page size. POST /v3/number-blockingreturns no id, andinboundandoutboundyou leave out are stored asnull, notfalse: send both flags explicitly.phone_numberon/v3/number-blockingis stored exactly as sent and the uniqueness check is an exact string match, so+353861234567and00353861234567are two entries. Use one format consistently.- Blacklist a number as
00followed by the country code and number (00353861234567): that is the form the send-time check compares against. A copy with a+or in national format is listed but may not stop the send. GET /v3/blacklist-numbers/{mobileNumber}and the delete ignore opted-out rows (status3): the check answers204for them and the delete leaves them in place.