APIs by Greg

Official Documentation.

APIs are provided as-is and without warranty. If you encounter any bugs or would like any new features, please contact me through my website.

Usage Limits

Typically, free APIs will not require credentials for use.  In these cases, usage will be monitored based on the IP the request originates from.

In general, I will try not to introduce hard usage limits on the API, however that should not be seen as an excuse to be inconsiderate to other users.  If your usage is excessive, your access might be disabled to protect the stability of the server.

Phone Number Verification

This API provides an easy way to verify that a phone number is in the correct format for a country or region.

End Point:

http://apis.gregvernon.com/api-v1/phonenumber/verify/{$number}/{$countryCode}

Inputs:

{$number}: required
String containing a phone number to test.

{$countryCode}:
String containing an ISO 3166 two character country code.  This specifies which country the phone number should be tested against.
Defaults to US

Outputs:

All output is a JSON string.  The output will be different depending on whether or not there is an error in computing the result.

Output JSON
{
	"meta": {
		"exception": (true|false),
		"messages": [] /* list of messages returned by the api*/
	},
	"result" {
		"valid": (true|false),
		"carrier": "", /* name of phone carrier. may not be available for all numbers */
		"nationalNumber": "", /* phone number */
		"type": "" /* type of phone number */
		"formats": {
			"e164": "", /* e164 formatted version of phone number */
			"display": "" /* phone number suitable for display */
		}
	}
}
Example Error:
GET http://apis.gregvernon.com/api-v1/phonenumber/verify
{
	"meta": {
		"exception": true,
		"messages": ["Missing phone number."]
	}
}
Example Invalid:
GET http://apis.gregvernon.com/api-v1/phonenumber/verify/8675309
{
	"result": {
		"valid": false
	}
}
Example Success:
GET http://apis.gregvernon.com/api-v1/phonenumber/verify/2023580001
{
	"result": {
		"valid": true,
		"carrier": "",
		"nationalNumber": "2023580001",
		"type": "FIXED_LINE_OR_MOBILE",
		"formats": {
			"e164": "+12023580001",
			"display": "(202) 358-0001"
		}
	}
}

If the country code cannot be found, the "unknown country code" symbol, ZZ, will be used.  Therefore, it is possible to have data in the meta::messages array, but also have valid data in result object as well.