list_available_phone_numbers
async
¶
list_available_phone_numbers(
iso_country_code: IsoCountryCode,
number_capabilities: NumberCapabilityList,
number_type: SearchableNumberType,
*,
config_overrides: Optional[AsyncPinpointSMSVoiceV2ClientConfig] = None,
registration_id: Optional[RegistrationIdOrArn] = None,
number_preference: Optional[NumberPreferenceList] = None,
next_token: Optional[NextToken] = None,
max_results: Optional[ListAvailablePhoneNumbersMaxResults] = None,
) -> ListAvailablePhoneNumbersResult
Retrieves a list of phone numbers that are available to request, based on the country, capabilities, and number type that you specify. You can optionally provide a number preference to return only numbers that match a specific digit pattern.
If no numbers match your search, this operation returns an empty list rather than an error. This operation currently supports only TEN_DLC number types in the US.
Parameters:
-
iso_country_code(IsoCountryCode) –The two-character code, in ISO 3166-1 alpha-2 format, for the country or region in which to search for available phone numbers. This operation currently supports only
US. -
number_capabilities(NumberCapabilityList) –The capabilities to filter by, such as SMS. Only phone numbers that support all of the specified capabilities are returned.
-
number_type(SearchableNumberType) –The type of phone number to search for.
-
registration_id(Optional[RegistrationIdOrArn], default:None) –The registration associated with the request. A registration is required for regulated number types. You can specify either:
-
The unique identifier of the registration.
-
The Amazon Resource Name (ARN) of the registration.
-
-
number_preference(Optional[NumberPreferenceList], default:None) –An optional selection preference used to return only phone numbers that match a specific digit pattern, such as numbers that start with, end with, or contain a particular sequence. You can specify at most one preference. Number preferences apply only to
TEN_DLCnumbers in theUS. -
next_token(Optional[NextToken], default:None) –The token returned from a previous request to retrieve the next page of results.
-
max_results(Optional[ListAvailablePhoneNumbersMaxResults], default:None) –The maximum number of results to return per page. If you don't specify a value, the default is 10.
Raises:
-
AccessDeniedException–The request was denied because you don't have sufficient permissions to access the resource.
-
ConflictException–Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.
-
InternalServerException–The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.
-
ResourceNotFoundException–A requested resource couldn't be found.
-
ThrottlingException–An error that occurred because too many requests were sent during a certain amount of time.
-
ValidationException–A validation exception for a field.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
ListAvailablePhoneNumbers Search for available TEN_DLC phone numbers in the US that start with a specific area code.
>>> await client.list_available_phone_numbers(iso_country_code='US', number_capabilities=['SMS'], number_type='TEN_DLC', registration_id='reg-1234567890abcdef0', number_preference=[{'PreferenceType': ['StartsWith'], 'Filter': ['+1206']}], max_results=10)
Source code in docs_src/capo_pinpoint_sms_voice_v2/_services/async_pinpoint_sms_voice_v2.py
4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 | |