This is the API V2 documentation. To switch out of beta revert back to our API V1.

Open SidemenuDocs
Docs
Close Sidemenu
Choose:
cURLPythonRubyNode
cURLPythonRubyNode

Number Ordersnumber-orders

With Telnyx, you can purchase numbers from 15,000+ rate centers and 40 different countries using our RESTful API.

If you're trying to figure out how to acquire your API key, take a look at the Development Environment Setup guide. It will also show you how to set up a Telnyx SDK if applicable.

Order a Numberorder-a-number

To see if a number is available, you'll need to carry out a search for that sepcific number. Once you have checked that, you'll need to purchase it.

curl -X POST \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --data '{
    "phone_numbers": [{"phone_number": "+18665552368"}]
  }' \
  https://api.telnyx.com/v2/number_orders

Note: Just after the purchase, the order will be in pending status until it's been confirmed. For numbers that have requirements please use our API V1 for now, this functionality is coming soon to API V2.

Retrieve All Ordersretrieve-all-orders

curl -X GET \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  "https://api.telnyx.com/v2/number_orders"

Sample Response

{
  "data": [
    {
      "connection_id": null,
      "created_at": "2018-11-19T15:55:00.319129+00:00",
      "customer_reference": null,
      "id": "123-543-54321-54321",
      "messaging_profile_id": null,
      "phone_numbers_count": 1,
      "record_type": "number_order",
      "requirements_met": true,
      "status": "success",
      "updated_at": "2018-11-19T15:55:00.319129+00:00"
    },
    {
      "connection_id": null,
      "created_at": "2018-10-31T16:42:34.518340+00:00",
      "customer_reference": null,
      "id": "4567-45678-45678-5743",
      "messaging_profile_id": null,
      "phone_numbers_count": 5,
      "record_type": "number_order",
      "requirements_met": true,
      "status": "pending",
      "updated_at": "2018-10-31T16:42:34.518340+00:00"
    },
  ],
  "meta": {
    "page_number": 1,
    "page_size": 25,
    "total_pages": 1,
    "total_results": 2
  },
  "url": "/v2/number_orders"
}

Retrieve An Orderretrieve-an-order

curl -X GET \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  "https://api.telnyx.com/v2/number_orders/{number_order_id}"

Sample Response

{
  "connection_id": null,
  "created_at": "2018-11-19T15:55:00.319129+00:00",
  "customer_reference": null,
  "id": "1234-56789-6789-5678",
  "messaging_profile_id": null,
  "phone_numbers": [
    {
      "id": "123cvgbh-fvgbhn-fvgbh-vgbh",
      "phone_number": "+15555555555",
      "record_type": "number_order_phone_number",
      "regulatory_requirements": [],
      "requirements_met": true,
      "status": "success"
    }
  ],
  "phone_numbers_count": 1,
  "record_type": "number_order",
  "requirements_met": true,
  "status": "success",
  "updated_at": "2018-11-19T15:55:00.319129+00:00"
}

Need some extra help?

Our support team are on hand 24/7/365, click the chat icon in the lower right hand corner to start chatting!

Was this page helpful?