> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# GetPhoneNumbers

POST https://api.voximplant.com/platform_api/GetPhoneNumbers

Gets the account phone numbers.

Allowed roles: `Owner`, `Admin`, `Developer`, `Supervisor`, `Accountant`, `Support`, `Payer`.

**Example request:** Get two attached phone numbers.

Reference: https://docs.voximplant.ai/api-reference/management-api/reference/phone-numbers/get-phone-numbers

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: management-api
  version: 1.0.0
paths:
  /GetPhoneNumbers:
    post:
      operationId: get-phone-numbers
      summary: GetPhoneNumbers
      description: >-
        Gets the account phone numbers.


        Allowed roles: `Owner`, `Admin`, `Developer`, `Supervisor`,
        `Accountant`, `Support`, `Payer`.


        **Example request:** Get two attached phone numbers.
      tags:
        - subpackage_phoneNumbers
      parameters:
        - name: phone_id
          in: query
          description: Particular phone ID to filter
          required: false
          schema:
            type: array
            items:
              type: integer
        - name: phone_number
          in: query
          description: >-
            Phone number list separated by semicolons (;) that can be used
            instead of **phone_id**
          required: false
          schema:
            type: array
            items:
              type: string
        - name: activation_status
          in: query
          description: >-
            Phone number activation statuses to filter, separated by semicolons
            (;).


            The possible values are: ACTIVE, ACTIVATING, DEACTIVATED,
            PROVISIONING, AWAITING_BUSINESS_PHONE_NUMBER_CONFIGURATION,
            LEGAL_OWNERSHIP_LIMIT_REACHED, GOSUSLUGI_DECLINED, SELF_BAN_ENABLED
          required: false
          schema:
            type: array
            items:
              type: string
        - name: application_id
          in: query
          description: Application ID
          required: false
          schema:
            type: integer
        - name: application_name
          in: query
          description: Application name that can be used instead of **application_id**
          required: false
          schema:
            type: string
        - name: is_bound_to_application
          in: query
          description: Whether the phone number bound to an application
          required: false
          schema:
            type: boolean
        - name: phone_template
          in: query
          description: Phone number start to filter
          required: false
          schema:
            type: string
        - name: country_code
          in: query
          description: Country code list separated by semicolons (;)
          required: false
          schema:
            type: array
            items:
              type: string
        - name: phone_category_name
          in: query
          description: Phone category name. See the [GetPhoneNumberCategories] method
          required: false
          schema:
            type: string
        - name: canceled
          in: query
          description: Whether the subscription is cancelled to filter
          required: false
          schema:
            type: boolean
        - name: deactivated
          in: query
          description: Whether the subscription is frozen to filter
          required: false
          schema:
            type: boolean
        - name: auto_charge
          in: query
          description: Whether the auto_charge flag is enabled
          required: false
          schema:
            type: boolean
        - name: from_phone_next_renewal
          in: query
          description: 'UTC ''from'' date filter in the following format: YYYY-MM-DD'
          required: false
          schema:
            type: string
        - name: to_phone_next_renewal
          in: query
          description: 'UTC ''to'' date filter in the following format: YYYY-MM-DD'
          required: false
          schema:
            type: string
        - name: from_phone_purchase_date
          in: query
          description: 'UTC ''from'' date filter in 24-h format: YYYY-MM-DD HH:mm:ss'
          required: false
          schema:
            type: string
        - name: to_phone_purchase_date
          in: query
          description: 'UTC ''to'' date filter in 24-h format: YYYY-MM-DD HH:mm:ss'
          required: false
          schema:
            type: string
        - name: child_account_id
          in: query
          description: >-
            Child account ID list separated by semicolons (;). Use the 'all'
            value to select all child accounts
          required: false
          schema:
            type: array
            items:
              type: integer
        - name: children_phones_only
          in: query
          description: Whether to get the children phones only
          required: false
          schema:
            type: boolean
            default: false
        - name: verification_name
          in: query
          description: Required account verification name to filter
          required: false
          schema:
            type: string
        - name: verification_status
          in: query
          description: >-
            Account verification status list separated by semicolons (;). The
            following values are possible: REQUIRED, IN_PROGRESS, VERIFIED
          required: false
          schema:
            type: array
            items:
              type: string
        - name: from_unverified_hold_until
          in: query
          description: >-
            Unverified phone hold until the date (from ...) in the following
            format: YYYY-MM-DD
          required: false
          schema:
            type: string
        - name: to_unverified_hold_until
          in: query
          description: >-
            Unverified phone hold until the date (... to) in the following
            format: YYYY-MM-DD
          required: false
          schema:
            type: string
        - name: can_be_used
          in: query
          description: Whether a not verified account can use the phone
          required: false
          schema:
            type: boolean
        - name: order_by
          in: query
          description: >-
            Following values are available: 'phone_number' (ascent order),
            'phone_price' (ascent order), 'phone_country_code' (ascent order),
            'deactivated' (deactivated first, active last), 'purchase_date'
            (descent order), 'phone_next_renewal' (ascent order),
            'verification_status', 'unverified_hold_until' (ascent order),
            'verification_name'
          required: false
          schema:
            type: string
        - name: sandbox
          in: query
          description: >-
            Flag allows you to display only the numbers of the sandbox, real
            numbers, or all numbers. The following values are possible: 'all',
            'true', 'false'
          required: false
          schema:
            type: string
        - name: count
          in: query
          description: Maximum returning record count
          required: false
          schema:
            type: integer
            default: 100
        - name: offset
          in: query
          description: First **N** records are skipped in the output
          required: false
          schema:
            type: integer
            default: 0
        - name: phone_region_name
          in: query
          description: Region names list separated by semicolons (;)
          required: false
          schema:
            type: array
            items:
              type: string
        - name: rule_id
          in: query
          description: Rule ID list separated by semicolons (;)
          required: false
          schema:
            type: array
            items:
              type: integer
        - name: rule_name
          in: query
          description: >-
            Rule names list separated by semicolons (;). Can be used only if
            __application_id__ or __application_name__ is specified
          required: false
          schema:
            type: array
            items:
              type: string
        - name: is_bound_to_rule
          in: query
          description: Whether the phone number is bound to some rule
          required: false
          schema:
            type: boolean
        - name: Authorization
          in: header
          description: >-
            Voximplant Management API uses signed JWT tokens generated from your
            service-account private key. Pass the token in the `Authorization`
            header as a Bearer value:


            ```

            Authorization: Bearer $VOXIMPLANT_TOKEN

            ```


            See [Authorization](/api-reference/management-api/authorization) for
            ready-to-copy snippets in bash, Python, Node.js and Go that turn
            your `credentials.json` into a token.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/phone-numbers_GetPhoneNumbers_Response_200
servers:
  - url: https://api.voximplant.com/platform_api
components:
  schemas:
    AttachedPhoneInfoType:
      type: object
      properties:
        phone_id:
          type: integer
          description: The phone ID
        phone_number:
          type: string
          description: The phone number
        phone_price:
          type: number
          format: double
          description: The phone monthly charge in the account's currency
        phone_country_code:
          type: string
          description: The phone country code (2 symbols)
        activation_status:
          type: string
          description: Phone number activation status
        phone_next_renewal:
          type: string
          description: |-
            Date string as returned by the Management API.

            The next renewal date in the following format: YYYY-MM-DD
        phone_purchase_date:
          type: string
          description: |-
            Timestamp in YYYY-MM-DD HH:mm:ss format.

            The purchase date in 24-h format: YYYY-MM-DD HH:mm:ss
        deactivated:
          type: boolean
          description: Whether the subscription is frozen
        canceled:
          type: boolean
          description: Whether the subscription is cancelled
        auto_charge:
          type: boolean
          description: Whether to charge automatically
        application_id:
          type: integer
          description: ID of the bound application
        application_name:
          type: string
          description: Name of the bound application
        rule_id:
          type: integer
          description: ID of the bound rule
        rule_name:
          type: string
          description: Name of the bound rule
        category_name:
          type: string
          description: The phone category name (MOBILE, GEOGRAPHIC, TOLLFREE, MOSCOW495)
        required_verification:
          type: string
          description: Whether the verification is required for the account
        verification_status:
          type: string
          description: >-
            The account verification status. The following values are possible:
            REQUIRED, IN_PROGRESS, VERIFIED
        unverified_hold_until:
          type: string
          description: >-
            Date string as returned by the Management API.


            Unverified phone hold until the date in the following format:
            YYYY-MM-DD (if the account verification is required). The number is
            detached on that day automatically!
        can_be_used:
          type: boolean
          description: Whether a not verified account can use the phone
        is_sms_supported:
          type: boolean
          description: >-
            Whether SMS is supported for this phone number. SMS needs to be
            explicitly enabled via the [ControlSms] Management API before
            sending or receiving SMS. If SMS is supported and enabled, SMS can
            be sent from this phone number via the [SendSmsMessage] Management
            API and received via the [InboundSmsCallback] property of the HTTP
            callback. See <a href='/docs/guides/managementapi/callbacks'>this
            article</a> for HTTP callback details
        is_sms_enabled:
          type: boolean
          description: >-
            Whether SMS sending and receiving is enabled for this phone number
            via the [ControlSms] Management API
        incoming_sms_callback_url:
          type: string
          description: >-
            If set, the callback of an incoming SMS is sent to this url,
            otherwise, it is sent to the general account URL
        emergency_calls_to_be_enabled:
          type: boolean
          description: >-
            Whether you need to make a request to enable calls to emergency
            numbers
        emergency_calls_enabled:
          type: boolean
          description: Whether calls to emergency numbers are enabled
        subscription_id:
          type: integer
          description: Phone number subscription ID
        extended_application_name:
          type: string
          description: Full application name, e.g. myapp.myaccount.n1.voximplant.com
        phone_region_name:
          type: string
          description: Phone region name
        modified:
          type: string
          description: >-
            Timestamp in YYYY-MM-DD HH:mm:ss format.


            UTC date of an event associated with the number in 24-h format:
            YYYY-MM-DD HH:mm:ss
      description: The [GetPhoneNumbers] function result.
      title: AttachedPhoneInfoType
    phone-numbers_GetPhoneNumbers_Response_200:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/AttachedPhoneInfoType'
          description: Phone numbers info
        total_count:
          type: integer
          description: Total found phone count
        count:
          type: integer
          description: Returned phone count
      title: phone-numbers_GetPhoneNumbers_Response_200
  securitySchemes:
    JwtAuth:
      type: http
      scheme: bearer
      description: >-
        Voximplant Management API uses signed JWT tokens generated from your
        service-account private key. Pass the token in the `Authorization`
        header as a Bearer value:


        ```

        Authorization: Bearer $VOXIMPLANT_TOKEN

        ```


        See [Authorization](/api-reference/management-api/authorization) for
        ready-to-copy snippets in bash, Python, Node.js and Go that turn your
        `credentials.json` into a token.

```

## SDK Code Examples

```python Example 1
import requests

url = "https://api.voximplant.com/platform_api/GetPhoneNumbers"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Example 1
const url = 'https://api.voximplant.com/platform_api/GetPhoneNumbers';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Example 1
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.voximplant.com/platform_api/GetPhoneNumbers"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Example 1
require 'uri'
require 'net/http'

url = URI("https://api.voximplant.com/platform_api/GetPhoneNumbers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Example 1
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.voximplant.com/platform_api/GetPhoneNumbers")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Example 1
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.voximplant.com/platform_api/GetPhoneNumbers', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Example 1
using RestSharp;

var client = new RestClient("https://api.voximplant.com/platform_api/GetPhoneNumbers");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Example 1
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.voximplant.com/platform_api/GetPhoneNumbers")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```