Latest Legacy

List account phone numbers

Returns a list of phone numbers that you’ve rented from Plivo or added from your carrier.

API Endpoint

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

Arguments

type string

The type of number. You can filter by local, mobile, fixed, national and tollfree numbers.

number_startswith string

Only show the phone numbers that begin with this pattern.

subaccount string

Returns phone numbers associated to this sub account.

alias string

Returns phone numbers that exactly match this alias.

services string

Filters phone numbers which provide the selected services . Possible values are:

  • voice: Indicates that phone numbers which can receive calls are to be returned.
  • sms: Indicates that phone numbers which can receive SMS are to be returned.
  • mms: Indicates that phone numbers that can receive MMS are to be returned.
  • voice,sms: Indicates that phone numbers which can receive both calls and SMS are to be returned.
  • voice,sms,mms: Indicates that phone numbers that can receive calls, SMS and MMS are to be returned.
limit integer

Used to display the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20.

offset integer

Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset based pagination here.

Returns

A dictionary with objects property that contains a list of up to limit account phone numbers. Each tuple in the list is a separate AccountPhoneNumber object. An empty list is returned if there are no phone numbers in the account matching the provided criteria.

Response

HTTP Status Code: 200

{
  "api_id": "114de006-1c95-11e4-8a4a-123140008edf",
  "meta": {
    "limit": 3,
    "next": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Number/?limit=3&offset=3",
    "offset": 0,
    "previous": null,
    "total_count": 20
  },
  "objects": [{
      "number": "18135401302",
      "alias": null,
      "sub_account": null,
      "added_on": "2014-08-05",
      "application": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/29986316244302815/",
      "carrier": "Plivo",
      "region": "Florida, UNITED STATES",
      "number_type": "local",
      "monthly_rental_rate": "0.80000",
      "sms_enabled": true,
      "sms_rate": "0.00000",
      "voice_enabled": true,
      "voice_rate": "0.00850",
      "resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Number/18135401302/"
    },
    {
      "number": "14153661106",
      "alias": "",
      "sub_account": null,
      "added_on": "2013-01-01",
      "application": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/16632559604105954/",
      "carrier": "Plivo",
      "region": "BELVEDERE, UNITED STATES",
      "number_type": "local",
      "monthly_rental_rate": "0.80000",
      "sms_enabled": true,
      "sms_rate": "0.00000",
      "voice_enabled": true,
      "voice_rate": "0.00850",
      "resource_uri": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Number/14153661106/"
    }
  ]
}

Example Request

1
2
3
4
5
6
7
8
import plivo

client = plivo.RestClient()
response = client.numbers.list(
    limit=5,
    offset=0,
    type='fixed', )
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Number List
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN")

begin
  response = api.numbers.list(
    limit: 5,
    offset: 0
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Example for Number list

var plivo = require('plivo');

(function main() {
    'use strict';
    
    // As the auth_id and auth_token are unspecified, Plivo will fetch them from the PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN environment variables.
    var client = new plivo.Client();
    client.numbers.list(
        {
            limit: 5,
            offset: 0,
        },
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/**
 * Example for Number list
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");

try {
    $response = $client->numbers->list(
        [
        	'limit' => 4,
        	'offset' => 4
        ]
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r(ex);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.plivo.api.samples.number;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.number.Number;
import com.plivo.api.models.base.ListResponse;

/**
* Example for Number list
*/
class NumberList {
    public static void main(String [] args) {
        Plivo.init();
        try {
            ListResponse<Number> response = Number.lister()
                .limit(5)
                .offset(0)
                .list();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Example for Number List
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
            try
            {
                var response = api.Number.List(
                    limit:5,
                    offset:0
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
1
2
curl -i --user AUTH_ID:AUTH_TOKEN \
    https://api.plivo.com/v1/Account/{auth_id}/Number/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Example for Number list
package main

import "fmt"
import "github.com/plivo/plivo-go"
 
func main() {
	client, err := plivo.NewClient("", "", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	response, err := client.Numbers.List(
		plivo.NumberListParams{
			Limit: 5,
			Offset: 0,
		},
	)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
}