These actions can be performed with the Number API:

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Number/

Prerequisites

  1. Sign up for a free Plivo trial account.
  2. Check out our server SDKs and install the SDK for the programming language you want to use.
  3. Buy a Plivo phone number. You need a Plivo phone number to receive calls. You can buy a Plivo phone number in more than 20 countries by visiting Phone Numbers > Buy Numbers in the Plivo console. Check the Voice API coverage page to see the supported countries.
  4. Use a web hosting service to host your web application. Many inexpensive cloud hosting providers charge just a few dollars a month. Follow the instructions of your hosting provider to host your web application.

List all rented numbers

This API call returns a list with the details of all numbers rented under your Plivo account.

GET https://api.plivo.com/v1/Account/{auth_id}/Number/

Code

import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.numbers.list(
    limit=5,
    offset=0)
print(response)

Get details of a rented number

This API call returns the details of a single number rented under your Plivo account.

GET https://api.plivo.com/v1/Account/{auth_id}/Number/{number}/

Code

import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.numbers.get(
    number='12025551111', )
print(response)
       

Edit a number

This API call lets you change the application and subaccount associated with a number you rented.

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

Code

import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.numbers.update(
    number='17609915566',
    alias='Updated Alias', )
print(response)
       

This API call lets you link an application to a number you rented.

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

Code

import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.numbers.update(
    number='17609915566',
    app_id='', )
print(response)
       

This API call lets you unlink an application from a number you rented.

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

Code

import plivo

auth_id = "<auth_id>"
auth_token = "<auth_token>"

p = plivo.RestAPI(auth_id, auth_token)

# Unlink an application from an number
params = {
    'number' : '12025551111' # Number that has to be unlinked from an application
}

response = p.unlink_application_number(params)
print str(response)
       

Relinquish a number

This API lets you relinquish a number on Plivo. Upon successful execution, the number will no longer be usable or accessible from your Plivo account. This operation cannot be undone.

DELETE https://api.plivo.com/v1/Account/{auth_id}/Number/{number}/

Code

import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')
response = client.numbers.delete(
    number='17609915566', )
print(response)
       

Next step

Learn how to Search and Rent Phone Numbers.