describe_phone_numbers

PinpointSMSVoiceV2.Client.describe_phone_numbers(**kwargs)

Describes the specified origination phone number, or all the phone numbers in your account.

If you specify phone number IDs, the output includes information for only the specified phone numbers. If you specify filters, the output includes information for only those phone numbers that meet the filter criteria. If you don't specify phone number IDs or filters, the output includes information for all phone numbers.

If you specify a phone number ID that isn't valid, an Error is returned.

See also: AWS API Documentation

Request Syntax

response = client.describe_phone_numbers(
    PhoneNumberIds=[
        'string',
    ],
    Filters=[
        {
            'Name': 'status'|'iso-country-code'|'message-type'|'number-capability'|'number-type'|'two-way-enabled'|'self-managed-opt-outs-enabled'|'opt-out-list-name'|'deletion-protection-enabled',
            'Values': [
                'string',
            ]
        },
    ],
    NextToken='string',
    MaxResults=123
)
Parameters
  • PhoneNumberIds (list) --

    The unique identifier of phone numbers to find information about. This is an array of strings that can be either the PhoneNumberId or PhoneNumberArn.

    • (string) --
  • Filters (list) --

    An array of PhoneNumberFilter objects to filter the results.

    • (dict) --

      The information for a phone number that meets a specified criteria.

      • Name (string) -- [REQUIRED]

        The name of the attribute to filter on.

      • Values (list) -- [REQUIRED]

        An array values to filter for.

        • (string) --
  • NextToken (string) -- The token to be used for the next set of paginated results. You don't need to supply a value for this field in the initial request.
  • MaxResults (integer) -- The maximum number of results to return per each request.
Return type

dict

Returns

Response Syntax

{
    'PhoneNumbers': [
        {
            'PhoneNumberArn': 'string',
            'PhoneNumberId': 'string',
            'PhoneNumber': 'string',
            'Status': 'PENDING'|'ACTIVE'|'ASSOCIATING'|'DISASSOCIATING'|'DELETED',
            'IsoCountryCode': 'string',
            'MessageType': 'TRANSACTIONAL'|'PROMOTIONAL',
            'NumberCapabilities': [
                'SMS'|'VOICE',
            ],
            'NumberType': 'SHORT_CODE'|'LONG_CODE'|'TOLL_FREE'|'TEN_DLC',
            'MonthlyLeasingPrice': 'string',
            'TwoWayEnabled': True|False,
            'TwoWayChannelArn': 'string',
            'SelfManagedOptOutsEnabled': True|False,
            'OptOutListName': 'string',
            'DeletionProtectionEnabled': True|False,
            'PoolId': 'string',
            'CreatedTimestamp': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • PhoneNumbers (list) --

      An array of PhoneNumberInformation objects that contain the details for the requested phone numbers.

      • (dict) --

        The information for a phone number in an Amazon Web Services account.

        • PhoneNumberArn (string) --

          The Amazon Resource Name (ARN) associated with the phone number.

        • PhoneNumberId (string) --

          The unique identifier for the phone number.

        • PhoneNumber (string) --

          The phone number in E.164 format.

        • Status (string) --

          The current status of the phone number.

        • IsoCountryCode (string) --

          The two-character code, in ISO 3166-1 alpha-2 format, for the country or region.

        • MessageType (string) --

          The type of message. Valid values are TRANSACTIONAL for messages that are critical or time-sensitive and PROMOTIONAL for messages that aren't critical or time-sensitive.

        • NumberCapabilities (list) --

          Describes if the origination identity can be used for text messages, voice calls or both.

          • (string) --
        • NumberType (string) --

          The type of phone number.

        • MonthlyLeasingPrice (string) --

          The price, in US dollars, to lease the phone number.

        • TwoWayEnabled (boolean) --

          By default this is set to false. When set to true you can receive incoming text messages from your end recipients using the TwoWayChannelArn.

        • TwoWayChannelArn (string) --

          The Amazon Resource Name (ARN) of the two way channel.

        • SelfManagedOptOutsEnabled (boolean) --

          When set to false an end recipient sends a message that begins with HELP or STOP to one of your dedicated numbers, Amazon Pinpoint automatically replies with a customizable message and adds the end recipient to the OptOutList. When set to true you're responsible for responding to HELP and STOP requests. You're also responsible for tracking and honoring opt-out request. For more information see Self-managed opt-outs

        • OptOutListName (string) --

          The name of the OptOutList associated with the phone number.

        • DeletionProtectionEnabled (boolean) --

          When set to true the phone number can't be deleted.

        • PoolId (string) --

          The unique identifier of the pool associated with the phone number.

        • CreatedTimestamp (datetime) --

          The time when the phone number was created, in UNIX epoch time format.

    • NextToken (string) --

      The token to be used for the next set of paginated results. If this field is empty then there are no more results.

Exceptions

  • PinpointSMSVoiceV2.Client.exceptions.ThrottlingException
  • PinpointSMSVoiceV2.Client.exceptions.AccessDeniedException
  • PinpointSMSVoiceV2.Client.exceptions.ResourceNotFoundException
  • PinpointSMSVoiceV2.Client.exceptions.ValidationException
  • PinpointSMSVoiceV2.Client.exceptions.InternalServerException