Once you hold a number, everything the portal’s Numbers pages do with it your own systems can do through the API. To find and order a number, see Getting numbers by API. The full reference lists every call and its fields. This page covers how they fit together.
Scopes
voice:readlists and reads numbers, and reads a bulk change.voice:updatelabels, routes and re-addresses numbers, sets SMS delivery, and makes a bulk change.voice:deletereleases a number, alone or in a bulk change.
Listing and reading numbers
GET /numbers lists your numbers in number order, with the same filters as
the portal’s Numbers page: q, type, szu, status, trunk,
routeType, assigned, hasEmergencyAddress, endUser for one end
user’s numbers, and needsAttention. q takes part of a number or its
description, and a national number such as 07 matches too. Set
format=csv or format=ndjson to stream every match in one response.
GET /numbers/{number} reads one number by its E.164 form, such as
61299999999, with its whole routing chain in routing.
Changing a number
PATCH /numbers/{number} changes any combination of a number’s fields.
A field you leave out stays as it is. Every field is checked before any is
applied, so a 422 means nothing changed.
descriptionis your label for the number, up to 80 characters.externalRefandmetadatahold your own references.
Routing a number to one place
Send routeType and routeTarget:
routeType |
routeTarget |
|---|---|
trunk |
The trunk’s sipUsername, or its id (a trunk with no SIP username, such as an IP-authenticated one, has only its id). |
redirect |
The phone number to forward to, in E.164, with or without +. It is stored and read back as digits. 000, 112 and 106 are refused in any form, with 422 and “Calls can’t be diverted to an emergency number (000, 112 or 106).” |
sip_address |
A SIP URI (sip:user@host), not a private or reserved address. |
fax2email |
The email address. Only for a number on one of your fax plans. |
disconnected |
None. disconnectResponse says what the caller hears (hangup if you send none). |
An Australian number needs an emergency address before it can be routed, so
send emergencyAddressId with the first route on a spare number.
A single route replaces the number’s whole chain. A number with a
failover, time-of-day or geographic routing has more than one route, and
its hasAdvancedRouting is true. On such a number routeType answers
409, names the steps it would delete, and changes nothing. Send
replaceRouting: true with it to replace them, or change the chain itself
as below.
The full routing chain
routing sets every route at once: a first route, up to three failovers,
time-of-day windows and geographic rules. Geographic rules are for 13, 1300
and 1800 numbers only. Each step is checked by the same rules as the
portal’s routing page.
- Read the number with
GET /numbers/{number}. - Change its
routinglist. A step with afailoverhands the call to the next step aftersecondsof ringing (afterSeconds) or when its destination cannot be reached (whenUnreachable). Atime_of_dayorgeographicstep sends the call to a plain route by the time or the caller’s location, and to itsfallbackotherwise. - Send the list back with
PATCH /numbers/{number}. A list read back and sent unchanged writes the same chain.
routing cannot be sent with routeType.
A trunk step names its trunk as a single route does, by sipUsername or
id. It reads back as the sipUsername, or as the id for a trunk with
none.
Emergency address
Send emergencyAddressId to list the number at another of your emergency
addresses. On a spare number it applies at once. On a number in use the
emergency register, the IPND, is updated shortly after. The answer has
emergencyAddressChange with status: pending, and emergencyAddressId
shows the old address until the change is done.
If the register refuses the record, ipnd.recordRejected says why and
whether the address needs fixing.
Inbound SMS on a mobile number
smsDelivery sets where a mobile number’s inbound SMS go. Any other number
answers 422.
method: webhookposts each message to a public HTTPSdestination, in the shapevendornames:generic,3cxoryeastar. Every request is signed. Foryeastar, send thesecretset on the PBX. Forgenericand3cx, leave it out and one is made for you. It is in this answer only, assmsDelivery.secret.method: emailsends each message to the email address indestination.method: nullturns forwarding off. Messages are still received and stored.
A field you leave out of smsDelivery keeps what is stored.
Changing many numbers at once
POST /numbers/bulk releases, routes or re-addresses up to 100 numbers in
one call. An Idempotency-Key is required, so a retry returns the first
call’s job instead of doing it again.
action: routesends every number straight totrunk, asipUsername. It replaces any failover, time-of-day or geographic routing those numbers had.action: emergencyAddresslists every number atemergencyAddressId.action: releasereleases every number, as below, and needsvoice:deletetoo.
Each number gets the same checks as the single call, and its own result. A
number refused, or not yours, is skipped with the reason and never stops
the rest. The call does the work before it answers, and answers 202 with
the job, done, and every number’s result. Read it again with
GET /numbers/bulk/{jobId}. The job is saved after each number. A call
that stops part way, such as on a timeout, leaves a job that reads
running, with the results of the numbers it reached.
Releasing a number
DELETE /numbers/{number} answers 202, and the release runs shortly
after. Until then the number reads releasing. Once it is done,
GET /numbers/{number} answers 404 and number.released fires.
A release stops the number working and stops its billing. The number then cools off for 30 days, when nobody can order it, you included, and after that anyone can. If your end user is moving to another provider, have them port the number out instead.
A release is refused with 409, and the number stays as it is, when:
- we have suspended the number. Contact Support to lift it.
- a trunk presents it as its default caller ID. Change that trunk’s
defaultCallerIdwithPATCH /trunks/{username}first.
If a trunk takes the number as its default caller ID after the 202, the
release is declined when it runs. The number reads active again, and
GET /account/summary counts it under numberReleaseDeclined for 30
days, or until you ask for the release again.
GET /numbers?needsAttention=numberReleaseDeclined lists them.
Webhooks
number.assignedwhen a number is put on a trunk, andnumber.unassignedwhen it comes off one. The number is still yours.number.releasedwhen a release has run.number.suspendedwhen we suspend a number, andnumber.reactivatedwhen we lift it.ipnd.recordRejectedwhen the emergency register refuses a number’s record.sms.receivedfor each inbound SMS on a mobile number.
Webhook event types lists each event’s fields.