Small CLI tool to query the Twilio Lookup API V2 for a phone number
The Twilio Lookup API provides a paid (per request) way to query the line information database for CNAM data used in caller ID services. The API also has an endpoint to identify the line type (landline, mobile, voip, etc) and carrier.
This tool provides a quick interface to query this API for a phone number and return some basic data in JSON format.
- Create a Twilio Account with access to the Lookup API. The API costs ~$0.01 per request.
- Set the environment variables
TWILIO_ACCOUNT_SID
andTWILIO_AUTH_TOKEN
. You can retrieve these values by followng the directions in this article.
$> twlu --help
CLI interface for the Twilio Lookup API V2
Usage: twlu [OPTIONS] <NUMBER>
Arguments:
<NUMBER> Phone number to lookup
Options:
-n, --caller-name Lookup Caller Name
-t, --line-type Lookup Line Type Intelligence
-h, --help Print help
$> twlu +14159929960
{
"call_forwarding": null,
"caller_name": {
"caller_name": null,
"caller_type": "UNDETERMINED",
"error_code": null
},
"calling_country_code": "1",
"country_code": "US",
"identity_match": null,
"line_type_intelligence": {
"carrier_name": "Bandwidth/13 - Bandwidth.com - SVR",
"error_code": null,
"mobile_country_code": "313",
"mobile_network_code": "981",
"type": "nonFixedVoip"
}
}