Once you hold a number, your systems can do everything the portal’s Numbers pages do with it. Finding and ordering a number is in Getting numbers by API. Each call and its fields are in the full reference.
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. It takes the same filters
as the portal’s Numbers page: q, type, szu, status, trunk,
routeType, assigned, hasEmergencyAddress, endUser and
needsAttention. endUser gives one end user’s numbers. q matches 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. Its whole routing chain is in routing.
Changing a number
PATCH /numbers/{number} changes any combination of a number’s fields.
Fields you leave out stay as they are. We check every field before applying
any, so a 422 means nothing changed.
description is your label for the number, up to 80 characters. externalRef
and metadata hold 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). It can’t be 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, and is hangup if you send none. |
An Australian number needs an emergency address before it can be routed. On a
spare number, send emergencyAddressId with the first route.
A single route replaces the number’s whole chain. A number with failover,
time-of-day or geographic routing has more than one route, and its
hasAdvancedRouting is true. On that number, routeType answers 409,
names the steps it would delete, and changes nothing. To replace them, send
replaceRouting: true with it. Otherwise 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. We check each step by the same rules as the portal’s
routing page.
- Read the number with
GET /numbers/{number}. - Change its
routinglist. Afailoverstep hands the call to the next step aftersecondsof ringing (afterSeconds), or when its destination can’t be reached (whenUnreachable). Atime_of_dayorgeographicstep sends the call to a plain route by the time or the caller’s location. It sends it to itsfallbackotherwise. - Send the list back with
PATCH /numbers/{number}. A list you read and send back unchanged writes the same chain.
You can’t send routing together with routeType.
A trunk step names its trunk the way a single route does, by sipUsername
or id. It reads back as the sipUsername, or as the id for a trunk
without one.
Emergency address
Send emergencyAddressId to list the number at another of your emergency
addresses. On a spare number the change applies at once. On a number in use,
we update the emergency register (the IPND) shortly after. The answer then has
emergencyAddressChange with status: pending. 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. On any other number
it answers 422.
method |
What happens |
|---|---|
webhook |
We post each message to a public HTTPS destination, in the shape vendor names: generic, 3cx or yeastar. Every request is signed. For yeastar, send the secret set on the PBX. For generic and 3cx, leave it out and we make one for you. It is in this answer only, as smsDelivery.secret. |
email |
We send each message to the email address in destination. |
null |
Forwarding is off. We still receive and store messages. |
Any 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. A retry returns the first call’s
job instead of doing the work again.
action |
What it does |
|---|---|
route |
Sends every number straight to trunk, a sipUsername. It replaces any failover, time-of-day or geographic routing those numbers had. |
emergencyAddress |
Lists every number at emergencyAddressId. |
release |
Releases every number, as below. It needs voice:delete too. |
Each number gets the same checks as the single call, and its own result. A
number that is refused, or not yours, is skipped with the reason. It never
stops the rest. The call does the work before it answers. It answers 202
with the job, done, and every number’s result. Read the job again with
GET /numbers/bulk/{jobId}. We save the job after each number. If a call
stops part way, for example on a timeout, the job reads running and holds
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. During that time nobody can order it, you included. 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, in two cases:
- 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.
A trunk might take the number as its default caller ID after the 202. The
release is then declined when it runs, and the number reads active again.
GET /account/summary counts it under numberReleaseDeclined for 30 days,
or until you ask for the release again.
GET /numbers?needsAttention=numberReleaseDeclined lists these numbers.
Webhooks
| Event | When it fires |
|---|---|
number.assigned |
A number is put on a trunk. |
number.unassigned |
A number comes off a trunk. The number is still yours. |
number.released |
A release has run. |
number.suspended |
We suspend a number. |
number.reactivated |
We lift a suspension. |
ipnd.recordRejected |
The emergency register refuses a number’s record. |
sms.received |
An inbound SMS arrives on a mobile number. |
Each event’s fields are in Webhook event types.