Help center
How to validate phone numbers in a signup form
Validate phone numbers on your server at signup: read the country, store E.164, check line type, and send a one-time code only to numbers that can receive it.
Updated 2026-11-23
Validate on your server when the form is submitted: send the number with a country, store the e164 value, branch on status and line_type, and send a one-time code only to numbers that passed. Validation tells you the number can exist and what type it is. The code proves the person holds it.
The flow
- The person picks a country and types a number.
- Your server sends both to the phone endpoint.
- You accept, ask for a correction, or add a verification step, based on the result.
- You store
e164, never the raw input.
Free way, while you design the form
Try real inputs from your market in the phone validator and the phone number formatter. See which formats people type and which results come back. Add a country selector next to the field, and a light pattern check in the browser for feedback only.
With the API
curl https://api.qelka.com/v1/phone \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone": "06 12 34 56 78", "country": "FR"}'
A basic call costs 1 credit. The fields to read:
{
"valid": true,
"status": "valid",
"e164": "+33612345678",
"line_type": "mobile",
"country": { "code": "FR", "name": "France", "calling_code": "33" }
}
status |
line_type |
At signup |
|---|---|---|
valid |
mobile |
Accept, store e164, send the code. |
valid |
landline, toll_free, premium_rate |
Ask for a mobile number if you need SMS. |
valid |
fixed_line_or_mobile |
Accept. Run a live lookup if SMS delivery matters. |
valid |
voip |
Accept and add a code. See Identify VoIP numbers. |
invalid |
any | Ask the person to check the number. |
unknown |
unknown |
Missing country. Ask again. |
In Node.js:
export async function checkPhone(phone, country) {
const response = await fetch('https://api.qelka.com/v1/phone', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(country ? { phone, country } : { phone }),
signal: AbortSignal.timeout(5000),
})
if (!response.ok) return { outcome: 'accept_unchecked' }
const result = await response.json()
if (result.status === 'unknown') return { outcome: 'ask_country' }
if (!result.valid) return { outcome: 'ask_correction' }
return { outcome: 'accept', e164: result.e164, lineType: result.line_type }
}
Fail open: if the API errors or times out, accept the number and check it later. A validation service should not be the reason nobody can sign up. See validate signup forms for the version with email and IP checks in one batch.
Choose the country
In order of reliability: the person's selection, a country you already know such as the billing address, then the country of the request. The last is a guess for travelers and VPN users, so let them change it. Avoid a fixed default for everyone.
Common mistakes
- Calling the API from the browser. It exposes your key.
- Validating on every keystroke. Each call costs credits. Check on submit.
- Storing the typed number. Store
e164, display withnational. - Blocking on
unknown. It is a missing country, not a bad number. - Skipping the code. Valid does not mean owned.
Related
Frequently asked questions
Should I validate the phone number in the browser or on the server?
What should I do when the check returns unknown?
country field.Do I still need an SMS code if I validate the number?
Put this check in your product
Get an API key in under a minute. 100 free credits every month, no card required.
- 100 free credits a month
- No card
- Test keys spend nothing
- Cancel any time