API Reference
Phone Validation API
Validate phone numbers in real time. Get the line type, carrier, porting status and disposable number signals before you send an OTP or accept a sign-up.
Base URL
All API requests should be made to the following base URL.
https://api.trueguard.io/v2Authentication
All API requests require authentication using your secret API key.
Security note
Never expose your secret API key in client-side code. Only use it in your backend services.Required Header
x-api-key: YOUR_SECRET_API_KEYEndpoints
Validate a single phone number and receive a full breakdown of validity, format, location, line and risk signals.
No live line test
The API does not call or ping the number. A valid number matches the numbering plan of its country. It is not proof that the line is in service./phone/validationPhone Validation
Validate a single phone number. Returns validity, formats, location, line type, carrier, porting and risk signals in one response.
import axios from 'axios';
const response = await axios.post(
"https://api.trueguard.io/v2/phone/validation",
{
phone: "+14155552671",
},
{
headers: {
"x-api-key": "YOUR_SECRET_API_KEY",
},
}
);curl -X POST https://api.trueguard.io/v2/phone/validation \
-H "x-api-key: YOUR_SECRET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone":"+14155552671"}'curl -X POST https://api.trueguard.io/v2/phone/validation \
-H "x-api-key: YOUR_SECRET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone":"(415) 555-2671","country":"US"}'Status
risk.status is the overall verdict. It is set from validity, risk.isDisposable and line.type (premium rate). No other field changes it.
safestatusThe number is valid, is not disposable and is not a premium rate number.
riskystatusThe number is valid, but it is disposable (risk.isDisposable is true) or a premium rate number.
invalidstatusThe input is not a phone number, has a wrong length or country code, or is in a range reserved for fiction.
unknownstatusThe country is not clear from the input, or the range is not known.
Validity reasons
validity.reason tells why a number is not valid. The type column shows the status that each reason gives.
notANumberinvalidThe input is not a phone number.
invalidCountryCodeinvalidThe number starts with + but the country calling code does not exist.
tooShortinvalidThe number has too few digits.
tooLonginvalidThe number has too many digits.
invalidLengthinvalidThe digit count is between the shortest and longest length for the country, but no number type has that length.
fictionalRangeinvalidThe range is reserved for films, TV and examples.
ambiguousCountryunknownThe number has no + and no country was sent, so the country is not clear.
unallocatedRangeunknownThe number range is not assigned to any operator.
unknownRangeunknownThe number does not match the numbering plan of its country.
Line types
All values of line.type.
mobileline.typeMobile number.
landlineline.typeFixed line number at a physical address.
voipline.typeVoIP number. line.voipType tells fixed and non-fixed VoIP apart.
fixedLineOrMobileline.typeThe country uses the same ranges for fixed and mobile lines, so the two cannot be told apart.
tollFreeline.typeToll free number, free for the caller.
premiumRateline.typePremium rate number. The caller pays a high rate.
sharedCostline.typeShared cost number. The caller and the receiver share the cost.
personalline.typePersonal number that forwards to another line.
pagerline.typePager number.
uanline.typeUniversal access number.
voicemailline.typeVoicemail access number.
shortCodeline.typeShort code.
m2mline.typeMachine-to-machine (IoT) number.
satelliteline.typeSatellite phone number.
unknownline.typeThe line type is not known, or the number is not valid.
Carrier types
All values of line.carrierType.
mnoline.carrierTypeMobile network operator that runs its own radio network.
mvnoline.carrierTypeMobile virtual network operator that uses the network of another operator.
cpaasVirtualline.carrierTypeCommunications platform (CPaaS) or virtual number provider.
fixedIspline.carrierTypeFixed line telephone company or internet provider.
m2mline.carrierTypeOperator for machine-to-machine and IoT connections.
satelliteline.carrierTypeSatellite operator.
unknownline.carrierTypeThe operator type is not known.
Error handling
HTTP status codes the API returns.
HTTP Status Codes
400Bad Request - Missing phone, phone longer than 64 characters, unsupported country code, or malformed request body401Unauthorized - Invalid or missing API key403Forbidden - Your plan does not include the Phone Validation API429Too Many Requests - Quota exceeded for the current billing period500Internal Server Error - Something went wrong on our endSupport
Need help with integration?
Check out our quick start guide or reach out to our support team for assistance with implementing the Phone Validation API.