Skip to content

list_phone_numbers_v2

list_phone_numbers_v2(
    *,
    config_overrides: Optional[ConnectClientConfig] = None,
    target_arn: Optional[ARN] = None,
    instance_id: Optional[InstanceId] = None,
    max_results: Optional[MaxResult1000] = None,
    next_token: Optional[LargeNextToken] = None,
    phone_number_country_codes: Optional[PhoneNumberCountryCodes] = None,
    phone_number_types: Optional[PhoneNumberTypes] = None,
    phone_number_prefix: Optional[PhoneNumberPrefix] = None,
) -> ListPhoneNumbersV2Response

Lists phone numbers claimed to your Connect Customer instance or traffic distribution group. If the provided TargetArn is a traffic distribution group, you can call this API in both Amazon Web Services Regions associated with traffic distribution group.

For more information about phone numbers, see Set Up Phone Numbers for Your Contact Center in the Connect Customer Administrator Guide.

  • When given an instance ARN, ListPhoneNumbersV2 returns only the phone numbers claimed to the instance.

  • When given a traffic distribution group ARN ListPhoneNumbersV2 returns only the phone numbers claimed to the traffic distribution group.

Parameters:

  • target_arn (Optional[ARN], default: None ) –

    The Amazon Resource Name (ARN) for Connect Customer instances or traffic distribution groups that phone number inbound traffic is routed through. If both TargetArn and InstanceId input are not provided, this API lists numbers claimed to all the Connect Customer instances belonging to your account in the same Amazon Web Services Region as the request.

  • instance_id (Optional[InstanceId], default: None ) –

    The identifier of the Connect Customer instance that phone numbers are claimed to. You can find the instance ID in the Amazon Resource Name (ARN) of the instance. If both TargetArn and InstanceId are not provided, this API lists numbers claimed to all the Connect Customer instances belonging to your account in the same Amazon Web Services Region as the request.

  • max_results (Optional[MaxResult1000], default: None ) –

    The maximum number of results to return per page.

  • next_token (Optional[LargeNextToken], default: None ) –

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

  • phone_number_country_codes (Optional[PhoneNumberCountryCodes], default: None ) –

    The ISO country code.

  • phone_number_types (Optional[PhoneNumberTypes], default: None ) –

    The type of phone number.

  • phone_number_prefix (Optional[PhoneNumberPrefix], default: None ) –

    The prefix of the phone number. If provided, it must contain + as part of the country code.

Raises:

Source code in docs_src/capo_connect/_services/connect.py
def list_phone_numbers_v2(
    self,
    *,
    config_overrides: Optional[ConnectClientConfig] = None,
    target_arn: Optional["capo_connect.types.arn.ARN"] = None,
    instance_id: Optional["capo_connect.types.instance_id.InstanceId"] = None,
    max_results: Optional["capo_connect.types.max_result1000.MaxResult1000"] = None,
    next_token: Optional[
        "capo_connect.types.large_next_token.LargeNextToken"
    ] = None,
    phone_number_country_codes: Optional[
        "capo_connect.types.phone_number_country_codes.PhoneNumberCountryCodes"
    ] = None,
    phone_number_types: Optional[
        "capo_connect.types.phone_number_types.PhoneNumberTypes"
    ] = None,
    phone_number_prefix: Optional[
        "capo_connect.types.phone_number_prefix.PhoneNumberPrefix"
    ] = None,
) -> "capo_connect.types.list_phone_numbers_v2_response.ListPhoneNumbersV2Response":
    """<p>Lists phone numbers claimed to your Connect Customer instance or traffic distribution group. If the provided <code>TargetArn</code> is a traffic distribution group, you can call this API in both Amazon Web Services Regions associated with traffic distribution group.</p> <p>For more information about phone numbers, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-center-phone-number.html">Set Up Phone Numbers for Your Contact Center</a> in the <i>Connect Customer Administrator Guide</i>.</p> <note> <ul> <li> <p>When given an instance ARN, <code>ListPhoneNumbersV2</code> returns only the phone numbers claimed to the instance.</p> </li> <li> <p>When given a traffic distribution group ARN <code>ListPhoneNumbersV2</code> returns only the phone numbers claimed to the traffic distribution group.</p> </li> </ul> </note>

    Args:
        target_arn: <p>The Amazon Resource Name (ARN) for Connect Customer instances or traffic distribution groups that phone number inbound traffic is routed through. If both <code>TargetArn</code> and <code>InstanceId</code> input are not provided, this API lists numbers claimed to all the Connect Customer instances belonging to your account in the same Amazon Web Services Region as the request.</p>
        instance_id: <p>The identifier of the Connect Customer instance that phone numbers are claimed to. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance. If both <code>TargetArn</code> and <code>InstanceId</code> are not provided, this API lists numbers claimed to all the Connect Customer instances belonging to your account in the same Amazon Web Services Region as the request.</p>
        max_results: <p>The maximum number of results to return per page.</p>
        next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
        phone_number_country_codes: <p>The ISO country code.</p>
        phone_number_types: <p>The type of phone number.</p>
        phone_number_prefix: <p>The prefix of the phone number. If provided, it must contain <code>+</code> as part of the country code.</p>

    Raises:
        capo_connect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the specified parameters are not valid.</p>
        capo_connect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_connect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_connect.types.list_phone_numbers_v2_request.ListPhoneNumbersV2Request]",
    ) -> OperationResponse[
        "capo_connect.types.list_phone_numbers_v2_response.ListPhoneNumbersV2Response"
    ]:
        import capo_connect._operations.amazon_connect_service.list_phone_numbers_v2

        output, http_response = (
            capo_connect._operations.amazon_connect_service.list_phone_numbers_v2.list_phone_numbers_v2(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPhoneNumbersV2")
    )
    input_: capo_connect.types.list_phone_numbers_v2_request.ListPhoneNumbersV2Request = {}
    if target_arn is not None:
        input_["target_arn"] = target_arn
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if phone_number_country_codes is not None:
        input_["phone_number_country_codes"] = phone_number_country_codes
    if phone_number_types is not None:
        input_["phone_number_types"] = phone_number_types
    if phone_number_prefix is not None:
        input_["phone_number_prefix"] = phone_number_prefix

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output