import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.numbers.buy(number='441273257545')
print(response)
HTTP Status Code: 201
{
    "api_id": "aa52882c-1c88-11e4-bd8a-12313f016a39",
    "message": "created",
    "numbers": [
        {
            "number": "14154009186",
            "status": "Success"
        }
    ],
    "status": "fulfilled"
}

Buys a phone number and adds it to your account. If the number is for a country that requires address and identity verification, you must provide verification documents before we can activate the phone number.

API Endpoint

POST
https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/{number}/

Arguments

app_id
string

The application to be assigned to the phone number. If not specified, the application selected as the default_number_app of the account is assigned. For more information, refer to the default_number_app argument under Application and app_id attribute in the Application object.

cnam_lookup
string

Enable or disable CNAM lookup on the number being rented. Applicable only for US local and toll-free numbers. Valid values are enabled and disabled. For other numbers, this value is null.

import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.numbers.buy(number='441273257545')
print(response)
HTTP Status Code: 201
{
    "api_id": "aa52882c-1c88-11e4-bd8a-12313f016a39",
    "message": "created",
    "numbers": [
        {
            "number": "14154009186",
            "status": "Success"
        }
    ],
    "status": "fulfilled"
}