Español

Lee este artículo en español.

How to validate a phone number in n8n (one node)

If you automate lead or order intake with n8n, at some point you need to check that a phone number is real and, while you're at it, put it in a consistent format (every customer types it differently: with spaces, without a country code, with dashes...). With the regular HTTP Request node and the Cofferdock API, you handle it in one step.

Quick note: n8n has no dedicated "validate phone" node. You do it with the HTTP Request node calling an API that recognizes the country, the number type (mobile, landline...) and returns it already formatted. Here's how, field by field.

What you'll get

You send the phone number and it tells you whether it's valid, which country it belongs to, what type it is (mobile, landline...), and returns it already formatted in E.164 (the standard used by SMS gateways) and in readable international format.

Common uses in n8n:

What you need

Step by step in the HTTP Request node

Add an HTTP Request node and fill it in like this:

{ "phone": "={{ $json.phone }}" }

The response includes valid, country, type, formatted_e164 and formatted_international. With a Set node you can keep just the formatted phone number for the rest of the flow.

A quick example

Say you normalize phone numbers before storing them in your CRM:

  1. A trigger (a webhook from a form) with the phone number exactly as the customer typed it.
  2. The HTTP Request node above, which validates and formats it.
  3. A node for your CRM that stores formatted_e164 instead of the raw text, so every phone number ends up in the same format.

Never again a phone number stored three different ways.

If the phone number has no international prefix

If your customers type the number "locally" (no +34, +1, etc. in front), add a default country in the same body:

{ "phone": "={{ $json.phone }}", "country": "US" }
OptionWhat it does
countryA 2-letter country code (ISO 3166-1) used when the number has no + prefix. For example US, GB, ES.

Prefer to see it in code?

The same call with curl:

curl -X POST "https://api.cofferdock.com/validate-phone" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone": "2025550123", "country": "US"}'

How much does it cost?

Each check uses 1 credit from your plan, whether the phone number comes back valid or not. Every Cofferdock tool draws from the same pool of credits.

FAQ

Does n8n have a native node to validate phone numbers? No. You do it with the HTTP Request node calling the Cofferdock API.

What happens if I don't send country and the number has no +? The API can't guess the country and the number comes back invalid. Always send country if your users don't type the international prefix.

What does type mean? When the library can determine it, it tells you whether the number is MOBILE, FIXED_LINE, VOIP, etc. Useful for filtering out landlines when you need to send an SMS.

Can I validate several phone numbers in a loop? Yes. If the previous node returns several rows, n8n runs the HTTP Request once per row.

Related guides

Try it yourself

You'll find the full instructions, with copy-paste examples, on the phone validation page. And if you don't have an account yet, you can create one for free and build your first flow today.