Purchase a Phone Number

Use this endpoint to purchase a phone number from available Flowroute inventory.

Endpoint

PUT /tns/telephone_number

Request Parameters

  • billing_method
    string required

    Sets the billing method to use. This will always be METERED, which are unlimited concurrent calls, each billed per-minute used.

  • telephone_number
    string required

    Phone number to purchase. The number must use an E.164 format, which is an 11-digit 1NPANXXXXXX-formatted number in North America.

Example Request

This assumes that you have the Python API Wrapper installed and set up.

#Instantiate the Controller
tnc = TelephoneNumbersController()

#Purchase a Phone Number
billing = BillingMethod(billing_method="METERED")
number = "15852003968"
response = tnc.purchase(billing,number)

                        

Example Request

This assumes that you have the PHP API Wrapper installed and set up. HP>

#Instantiate the Controller
$tnc = new TelephoneNumbersController();

#Pass the BillingMethod
use FlowrouteNumbersLib\Models\BillingMethod;

#Purchase a Phone Number
$billing_method = new BillingMethod('METERED');
$phone_number = '15852003968';
$response = $tnc->purchase($billing_method, $phone_number);

                        

Example Request

This assumes that you have the Ruby API Wrapper installed and set up.

#Instantiate the Controller
tnc = FlowrouteNumbers::TelephoneNumbersController.new()

#Purchase a Phone Number
response = tnc.purchase(billing="METERED", number="15852003968")

                    

Example Request

This assumes that you have the Node.js API Wrapper installed and set up.

/*
1. Load the Numbers v1 SDK and Node.js util module
2. Declare flowroutenumberslib path relative to your JS file
*/
var flowroute = require('./flowroutenumberslib'); 
var util = require('util');

//Define your callback function
var cb =  function(err, response){
  if(err){
   console.log(err);
   }
       console.log(util.inspect(response, false, null));
};

//Purchase a Phone Number
var billingMethod = {"billing_method":"METERED"};
flowroute.TelephoneNumbersController.purchase(billingMethod, 15852003968, cb);

                  

Example Response

201 Created

{ }