On this page
A phone field is where clean data goes to die: brackets, spaces, missing country codes, landlines entered for SMS. Validate once at input and you'll never fire an OTP into the void again.
The problem with raw phone input
Users type (0532) 123 45 67, +90 532 123 4567, and 05321234567 for the same number. Your SMS provider wants exactly one format — E.164 — and charges you whether or not the message lands. The Phone Validation endpoint normalizes the input and tells you whether it's even reachable.
curl "https://api.locabium.com/v1/validate/phone?number=%2B905321234567" \
-H "Authorization: Bearer $LOCABIUM_KEY"{
"number": "+905321234567",
"valid": true,
"e164": "+905321234567",
"country": "TR",
"line_type": "mobile",
"carrier": "Turkcell"
}Use the parts that matter
e164→ the canonical form to store and hand to your SMS gateway.valid: false→ reject before you spend a message credit.line_type→ blocklandlineandvoipwhen you specifically need an SMS-capable mobile for OTP.countryandcarrier→ useful for routing and fraud scoring.
Validate on the client, confirm on the server
Format as the user types with react-phone-number-input, then confirm server-side before you trust it. Store only the e164 value.
const r = await fetch(
`https://api.locabium.com/v1/validate/phone?number=${encodeURIComponent(input)}`,
{ headers: { Authorization: `Bearer ${process.env.LOCABIUM_KEY}` } },
);
const p = await r.json();
if (!p.valid || p.line_type !== "mobile") {
return { ok: false, reason: "Enter a mobile number that can receive SMS." };
}
await sendOtp(p.e164);Block landlines and VoIP only when the channel truly requires a mobile. For a contact form, a landline is a perfectly good phone number — don't over-reject.
Ready to build this?
View API docs