📱 Phone Validation
Validate phones.
A better, simpler way to validate phones with Dymo API in a single line of code!
About Phone Validation
What is Phone Validation?
Please note that this feature may depend on plugins to function correctly.
Usage
Once we have created and configured our API object, it is quite simple, we just need to execute the following code.
import DymoAPI from "dymo-api";
const dymoClient = new DymoAPI({
apiKey: "PRIVATE_TOKEN_HERE"
});
const decision = await dymoClient.isValidPhone("+34617509462");
import DymoAPI from "dymo-api";
const dymoClient = new DymoAPI({
apiKey: "PRIVATE_TOKEN_HERE",
rules: {
phone: {
// These are the default rules defined for phone validation.
deny: ["FRAUD", "INVALID"]
}
}
});
const decision = await dymoClient.isValidPhone("+34617509462");
import DymoAPI from "dymo-api";
const dymoClient = new DymoAPI({
apiKey: "PRIVATE_TOKEN_HERE",
rules: {
phone: {
// These are the default rules defined for phone validation.
deny: ["FRAUD", "INVALID"]
}
}
});
// You can overwrite the predefined rules at any time.
const decision = await dymoClient.isValidPhone("+34617509462", { deny: ["INVALID"] });
Phone Rules
| Rule | Default | Premium | Description |
|---|---|---|---|
FRAUD | ✅ | ❌ | Fraud detection |
INVALID | ✅ | ❌ | Invalid phone format |
COUNTRY:<COUNTRY_CODE> | ❌ | ❌ | Block an phone based on its country; you must use ISO 3166-1 alpha-2. |
HIGH_RISK_SCORE | ❌ | ✅ | High risk score detection |
Response
The more data types you add, the longer the response time will be.
{
phone: "+34617509462",
allow: true,
reasons: [],
response: {
valid: true,
fraud: false, // Also for disposable data.
phone: "+34617509462",
prefix: "34",
number: "617509462",
lineType: "Unknown",
carrierInfo: {
carrierName: "Vodafone",
accuracy: 50,
carrierCountry: "Spain",
carrierCountryCode: "ES"
},
country: "Spain",
countryCode: "ES",
plugins: {...}
}
}