Purchase a phone number
Purchase an available phone number. Requires a paid plan: the Free plan cannot purchase phone numbers and receives 402 with code paid_plan_required.
The included number. A paid plan includes one number at no charge, once per account: it must be a US or Canadian number (a +1 number) costing $20 a month or less. isFreeEligible in GET /v1/phone-numbers/available marks the numbers that qualify. Claiming it spends the benefit for good, across every team the account owner owns, so releasing that number does not make another one free.
Numbers with regulatory requirements. Which numbers need regulatory information is decided per number, not by a fixed country list. The purchase looks the requirements up for the exact number before charging anything:
GET /v1/phone-numbers/requirements?phoneNumber=.... Ifitemsis empty, buy normally.- Create what it asks for: addresses with
POST /v1/addresses, documents withPOST /v1/documents. - Purchase with
typeandregulatoryRequirements. The number is bought and billed at once withregulatoryStatus: pending_review. - Poll
GET /v1/phone-numbers/{phoneNumberId}untilregulatoryStatusisapproved. Assign it to a sender before or after approval; it starts carrying messages once approved.
Reuse. Information you submitted is kept for your project, per country and type, and a later purchase there may omit regulatoryRequirements. Reuse only happens when what is kept still covers every requirement of the new number and every address and document in it belongs to the project. Otherwise, or when nothing is kept, the purchase returns 400 regulatory_compliance_required with the missing requirements in details.
Invalid values (a missing, unknown or repeated requirement id, an address or document from another project, or one rejected in review) return 400 invalid_request. If an address or document cannot be registered for review, the purchase returns 400 invalid_request naming the requirement. If the requirements cannot be looked up, the purchase returns 502 requirements_unavailable, except for US and Canadian numbers, which are sold as numbers without requirements. None of these errors charge anything.
Authorization
AuthorizationheaderrequiredBearer YOUR_API_KEY. Create a key in the dashboard.
Body
application/json
phoneNumberstringrequiredPhone number in E.164 format.
namestringOptional custom name for the phone number.
Limitsmax length 100typestringType the number was found under in
GET /v1/phone-numbers/available. Used to look the number up and to keep regulatory information for reuse. Required whenregulatoryRequirementsis sent.toll_freeis accepted as an alias oftollFree. A number not listed under this type is refused with400 number_unavailablesaying so.One oflocalnationaltollFreemobileregulatoryRequirementsobject[]Regulatory information, for numbers whose requirements list is not empty. Get the list with
GET /v1/phone-numbers/requirements?phoneNumber=...and send one entry per requirement id, exceptactionrequirements, which take no value. Every required id must be present, once, and no unknown id may be sent; otherwise the purchase is refused with400 invalid_requestbefore anything is charged.The information is kept for your project under the number's country and
type. A later purchase there may omit this field if what is kept still covers that number's requirements. Omit it for numbers without requirements.Limitsmax items 502 properties
requirementTypestringrequiredA
requirementTypes[].idfromGET /v1/phone-numbers/requirements. Each id may appear only once.Limitsmin length 1 · max length 200fieldValuestringrequiredDepends on the requirement's
type: the text itself fortextual; foraddress, theidof an address created in this project withPOST /v1/addresses; fordocument, theidof a document created withPOST /v1/documents. An address or document from another project, or one rejected in review, is refused.Limitsmin length 1 · max length 1000
Responses
201Phone number purchased successfully.
phoneNumberobjectrequired12 properties
idstringrequiredphoneNumberstringrequirednamestringOptional custom name for the phone number.
capabilitiesstring[]requiredstatusstringrequiredBilling state of an owned number, separate from
regulatoryStatus.pendingis legacy and is not written to numbers today. The SDKs carryactive,suspendedandpendingonly;releasingandreleasedare returned by the REST API until their next release.One ofactivesuspendedpendingreleasingreleasedsenderIdstringSender ID if the phone number is assigned to a sender.
pricingobjectrequired4 properties
monthlyPricenumberMonthly price in USD.
upfrontCostnumberOne-time purchase cost in cents.
monthlyCostnumberMonthly cost in cents.
isFreeNumberbooleanWhether this is a free number.
regulatoryStatusstringrequiredRegulatory review state. Numbers that need no review are
approvedimmediately. A number bought with regulatory information is owned and billed from purchase and startspending_review; it cannot send messages or place calls until this isapproved. The state is re-checked every 6 hours: pollGET /v1/phone-numbers/{phoneNumberId}to follow it.Assign it to a sender with
PATCH /v1/phone-numbers/{phoneNumberId}(senderId) before or after approval. A number assigned while under review is recorded and connected to that sender when it is approved; the connection is retried until it succeeds. A sender created over the API is set up for SMS as part of the assignment.rejectedmeans review refused the information: the number cannot be assigned to a sender. A number that stayspending_reviewmay be waiting on information the API cannot supply; contact support.One ofapprovedpending_reviewrejectednextRenewalDatestring<date-time>releaseAtstring<date-time>When the number goes back to the carrier, if it is on its way out. Absent otherwise.
- A paid plan ended. Without a paid plan a team keeps one number: the one chosen in the dashboard when cancelling, else the one the plan included, else the oldest it bought. That number is billed monthly from the balance and has no
releaseAtunless a renewal fails. Every other number keeps working, unbilled, until this date, 7 days after the plan ended. Numbers you brought yourself are never released. - A renewal could not be paid. The number is suspended and released at the end of a 7-day grace.
Paying, or returning to a paid plan, before this date keeps the number. A released number cannot be recovered.
- A paid plan ended. Without a paid plan a team keeps one number: the one chosen in the dashboard when cancelling, else the one the plan included, else the oldest it bought. That number is billed monthly from the balance and has no
createdAtstring<date-time>requiredupdatedAtstring<date-time>
400Invalid request, the number is no longer available or not listed under the `type` sent (`number_unavailable`), the country is restricted, regulatory information is missing (`regulatory_compliance_required`), or the regulatory information sent is invalid (`invalid_request`).
codestringrequiredmessagestringrequireddetailsobject
401Unauthorized.
codestringrequiredmessagestringrequireddetailsobject
402Payment required. Either the balance cannot cover the purchase (code `insufficient_balance`) or the team is on the Free plan (code `paid_plan_required`): buying phone numbers requires a paid plan, which includes one US number.
codestringrequiredmessagestringrequireddetailsobject
502The number's regulatory requirements could not be looked up, so nothing was charged. Retry. Not returned for US and Canadian numbers.
codestringrequiredmessagestringrequireddetailsobject