list_available_phone_numbers
¶
list_available_phone_numbers(
iso_country_code: IsoCountryCode,
number_capabilities: NumberCapabilityList,
number_type: SearchableNumberType,
*,
config_overrides: Optional[PinpointSMSVoiceV2ClientConfig] = 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.
>>> 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/pinpoint_sms_voice_v2.py
4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 | |