Lookup API helps you format phone numbers and retrieve additional information before sending SMS and MMS messages or making voice calls. Unformatted numbers may be invalid, which can cause calls and messages to fail. With Lookup, you can identify local number formats and reduce the likelihood of undelivered messages. Here’s how to get started with the Lookup API.
Sign up for a Plivo account
If you’re not already a Plivo customer, you can sign up for a free trial account to experiment with and learn about our services. Be sure to sign up with your work email address and not one from a generic email provider. Each trial account comes with free credits. You can add more credits and buy a phone number to test the full range of our voice and SMS service features.
If you have any issues creating a Plivo account, please reach out to our support team for help.
Once you have an account, read about our server SDKs and install the one for the programming language you want to use.
Looking up a number
Lookup API enables you to identify phone number types (mobile, fixed, VoIP, and toll-free) and the service provider of the phone number, including ported numbers in the US and Canada.
<?phprequire'vendor/autoload.php';usePlivo\RestClient;$client=newRestClient("<auth_id>","<auth_token>");$client->client->setTimeout(40);// Numberlookup API Producttry{$response=$client->lookup->get("<your_number>");print_r($response);}catch(PlivoRestException$ex){print_r(ex);}
usingSystem;usingSystem.Collections.Generic;usingPlivo;usingPlivo.Exception;namespacetest_apps{classProgram{staticvoidMain(string[]args){varapi=newPlivoApi("<auth_id>","<auth_token>");// Number Look Up APItry{varresponse=api.Lookup.Get("<your_number>");Console.WriteLine(response);}catch(PlivoRestExceptione){Console.WriteLine("Exception: "+e.Message);}}}}