Skip to main content

phone_number_validation

Phone Number Validation

Validates a phone number and returns its country, its national and international formats, and the network it was originally assigned to.

Requires an API Key licensed for phone validation.

Every query decrements your lookup balance, including a number that fails to parse and a number reported as invalid.

Endpoint​

GET /phone_numbers

See the API reference for this endpoint.

Import​

from ideal_postcodes import IdealPostcodes

Call phone_number_validation on the IdealPostcodes client. Path parameters are positional; query and body parameters are keyword-only.

Path Parameters​

None.

Query Parameters​

NameTypeRequiredDescription
querystryesSpecifies the phone number to validate. Phone number must include a country code in an acceptable format. For instance, UK phone numbers should be prefixed with +44, 44 or 0044.
current_carrierLiteral['true'] | strnoWhen set to true, the API retrieves and populates the current network of the phone number. This operation can be slow, depending on the network and local conditions.
tagsstrnoTags A comma separated list of tags to query over. Useful if you want to specify the circumstances in which the request was made. If you specify multiple tags, the response comprises only requests that satisfy all of them. Searching "foo,bar" queries only requests tagged both "foo" and "bar".

Response Type​

from ideal_postcodes.types import PhoneNumberValidationResult

Errors​

Unsuccessful HTTP responses raise APIError or a subclass, with the HTTP status and the API error code and message. Connection failures and timeouts raise TransportError. Unexpected responses raise ProtocolError. All derive from ClientError. See error handling.

Example​

phone_number_validation.pypython
from ideal_postcodes import IdealPostcodes

with IdealPostcodes("ak_test") as client:
phone = client.phone_number_validation(query="+442079460000")