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

Open SidemenuDocs
Docs
Close Sidemenu
Choose:
cURLNodePythonRuby
cURLNodePythonRuby

Number Ordersnumber-orders

You can purchase numbers from 15,000+ rate centers and 40 different countries via our RESTful APIAPI.

Check out the Development Environment Setup guide to acquire your API Key and set up a Telnyx SDK if applicable.

Order a Numberorder-a-number

First, you'll need to search for the number to make sure it's available. Once you've done this, you're ready to purchase.

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 V1API for now, this functionality is coming soon to API V2.

Congrats, you’ve just purchased your first phone number using the Telnyx API.

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 Responsesample-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 Responsesample-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"
}

Was this page helpful?was-this-page-helpful