import plivo
import json

client = plivo.RestClient('<auth_id>','<auth_token>')
powerpack = client.powerpacks.get(uuid="<powerpack_uuid>")
print str(powerpack.list_numbers(starts_with=512, country_iso2='US'))
{
  "api_id": "06c15d7c-7ed5-11ea-855f-0242ac110003",
  "meta": {
    "limit": 20,
    "next": "",
    "offset": 0,
    "previous": "",
    "total_count": 1
  },
  "objects": [
    {
      "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
      "added_on": "2023-03-18T16:07:39.379739Z",
      "country_iso2": "US",
      "number": "{your_number}",
      "number_pool_uuid": "{number_pool_uuid}",
      "service": "mms",
      "type": "fixed"
    },
   {
      "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
      "added_on": "2023-03-18T16:07:39.379739Z",
      "country_iso2": "US",
      "number": "{your_number}",
      "number_pool_uuid": "{number_pool_uuid}",
      "service": "sms",
      "type": "fixed"
    }
    {
      "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
      "added_on": "2022-10-09T11:24:35.085797Z",
      "country_iso2": "CA",
      "number": "{your_number}",
      "number_pool_uuid": "{number_pool_uuid}",
      "service": "sms",
      "type": "fixed"
    }
  ]
}

This API fetches a list of numbers from a number pool based on the number_pool_UUID specified in the resource URI.

API Endpoint

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

Arguments

starts_withA comma-separated list of prefixes.
Assume the values provided exclude the country code prefix.
A max of 10 prefixes may be specified.
Throws 400 Bad Request if more than 10 prefixes are specified.
typefixed, toll-free, or mobile. Note that local and national numbers should be considered as ‘fixed’.
servicesms or mms. Use this argument to filter the numbers by capability.
country_iso2
Conditional
ISO2 code of the phone number country.
This attribute must be specified if the starts_with filter is specified.
limitUsed to display the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20.
offset

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

 

Returns

This API returns the list of numbers from the number pool that match the filters specified in the request.

The API response also contains a meta field with the following fields:

  • limit: The size of the page returned in the response.
  • next: The URL that points to the next page of results.
  • offset: The offset for the page returned in the response.
  • previous: The URL that points to the previous page of results.
  • total_count: The total number of records that match the specified filters.
import plivo
import json

client = plivo.RestClient('<auth_id>','<auth_token>')
powerpack = client.powerpacks.get(uuid="<powerpack_uuid>")
print str(powerpack.list_numbers(starts_with=512, country_iso2='US'))
{
  "api_id": "06c15d7c-7ed5-11ea-855f-0242ac110003",
  "meta": {
    "limit": 20,
    "next": "",
    "offset": 0,
    "previous": "",
    "total_count": 1
  },
  "objects": [
    {
      "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
      "added_on": "2023-03-18T16:07:39.379739Z",
      "country_iso2": "US",
      "number": "{your_number}",
      "number_pool_uuid": "{number_pool_uuid}",
      "service": "mms",
      "type": "fixed"
    },
   {
      "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
      "added_on": "2023-03-18T16:07:39.379739Z",
      "country_iso2": "US",
      "number": "{your_number}",
      "number_pool_uuid": "{number_pool_uuid}",
      "service": "sms",
      "type": "fixed"
    }
    {
      "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
      "added_on": "2022-10-09T11:24:35.085797Z",
      "country_iso2": "CA",
      "number": "{your_number}",
      "number_pool_uuid": "{number_pool_uuid}",
      "service": "sms",
      "type": "fixed"
    }
  ]
}