Overview
When you search for numbers, four outcomes are possible:- The search returns available phone numbers that you can purchase.
- The search targets a region where Telnyx has no coverage, resulting in a
4xxresponse. - The request errors out due to a server issue (
5xx) or a timeout. - Telnyx has coverage but no available numbers matching the given search criteria. This is when the Advanced Order Request API is useful.
Constraints
- Not eligible for US or CA toll free phone numbers. The search API reflects all possible inventory.
- Not eligible for unique phone numbers (i.e. I request phone number 123-456-7890, I request a phone number that ends in 0000, etc.).
- Advanced orders are best effort. Telnyx cannot guarantee that we will be able to procure the phone numbers you request.
Advanced Order Statuses
- pending: The Advanced Order has been created but is not yet being processed by Telnyx.
- processing: The Advanced Order is currently being processed by Telnyx.
- exception: There is an issue with the advanced order. Please review it and take the appropriate actions to resolve the issue.
- hold: Telnyx needs to replenish our inventory to fulfill your request. This process can take some time. No further action is needed on your end, the order will remain in this status until Telnyx is able to replenish those phone numbers.
- ordered: The Advanced Order has been successfully placed and fulfilled.
- failed: The Advanced Order could not be completed.
How it works
1. Search for phone numbers to purchase
First, search for your phone numbers using theGET v2/available_phone_numbers endpoint (API reference here, developer guide here).
If no results are returned, you can try to adjust your search filters to find similar phone numbers that are immediately available.
2. If no results are returned, create an Advanced Order
If no results are returned for your search (even after attempting to find alternatives), create an Advanced Order using thePOST /v2/advanced_orders endpoint (API reference here). In the body of the request, include the same values that you were using as search parameters previously.
3. Add regulatory requirements to an Advanced Order
In most countries, our Number Ops team can only procure phone numbers if you provide the necessary regulatory requirements. In these cases, Number Ops will reach out and ask you to provide the applicable regulatory requirements.- Create a requirement group that matches the “country” and “phone number type” of your Advanced Order.
- Make a
PATCH https://api.telnyx.com/v2/advanced_orders/:order_id/requirement_grouprequest (API reference here). Use the requirement groupidas the “requirement_group_id” value in the request body. - If you need to edit the requirements associated with the Advanced Order, edit them on the requirement group first. Then
PATCH v2/advanced_orders/:order_id/requirement_groupthe Advanced Order again. The updated requirements will override the original ones you submitted.
advanced_order_requirements array will contain the values from your requirement group.
4. Finish the number ordering process
When an Advanced Order transitions toordered status, Number Ops has placed number order(s) on your account for the requested phone numbers.
Check the orders array in the Advanced Order API response to see which number orders were placed. The orders array lists the Number Order IDs for the orders that were placed.
You can then use the GET v2/number_orders/:number_order_id request (API reference here) to:
- View details about the actual number order that was placed.
- View which phone numbers were ordered.
- View the status of the order.
- View if there are any regulatory requirements to be fulfilled.
Comments
You can communicate with the Number Operations team about your request through the Comments API. Usefilter[comment_record_type]=advanced_number_order and specify the advanced order ID as the comment_record_id in the API requests.