List all rented numbers API

    The API gets the details of a phone number that you’ve rented from Plivo or added from your carrier.

    API Endpoint

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

    Arguments

    type string

    The type of number. You can filter by local, mobile, fixed, national, or toll-free numbers.

    number_startswith string

    Only show phone numbers that begin with this pattern.

    subaccount string

    Returns phone numbers associated with this subaccount.

    alias string

    Returns phone numbers that exactly match this alias.

    services string

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

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

    Denotes the number of results to display 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.

    object_typestring

    Users can pass object_type as trunk.

    Mandatory parameter when object_id is present.

    Object_type will support trunk, phlo, and xml as values in the next release.

    object_idstring

    Users can pass trunk_id.

    Mandatory parameter when object_type is present.

    Object_id will support trunk_id, phlo_id, and xml_id as values in the next release.

    Returns

    A dictionary with an objects property that contains a list of up to limit account phone numbers. Each tuple in the list is a separate AccountPhoneNumber object. Plivo returns an empty list if there are no phone numbers in the account that match 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",
          "object_id": "17248282830499840",
          "object_type": "trunk",
          "alias": null,
          "sub_account": null,
          "added_on": "2021-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": "2022-01-01",
          "application": "/v1/Account/MAXXXXXXXXXXXXXXXXXX/Application/16632559604105954/",
          "carrier": "Plivo",
          "region": "BELVEDERE, UNITED STATES",
          "number_type": "local",
          "object_id": "17248282830499840",
          "object_type": "trunk",
          "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
    
    1
    
    1
    
    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("<auth_id>","<auth_token>");
    
    try {
        $response = $client->numbers->list(
            [
                'object_id' => '33123401372191272',
                'object_type' => 'trunk'
            ]
        );
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    
    1
    
    1
    
    1
    2
    
    curl -i --user AUTH_ID:AUTH_TOKEN \
        https://api.plivo.com/v1/Account/{auth_id}/Number/
    
    1