Docs · Validators

phone validator

Lightweight pattern check for phone-like strings. No country logic.

One of 19 validator types · pure compute, no AI cost

Reference

Format

Matches `/^[+]?[\d\s().-]{7,20}$/`. Optional leading `+`, then 7–20 chars of digits, spaces, parens, dots, or hyphens.

Examples

  • +41 79 123 45 67
  • (415) 555-2671
  • +1.415.555.2671

How it runs

Implementation

A faithful summary of lib/validators.ts. Validators are pure functions and run identically in the Worker, the Workbench and the MCP server — one implementation, so the three cannot disagree about whether a value is valid.

lib/validators.ts
function validPhone(value) {
  // Lightweight check. Production swaps libphonenumber-js behind the same shape.
  return /^[+]?[\d\s().-]{7,20}$/.test(value)
    ? OK
    : fail('phone_invalid', 'not a valid phone')
}

Config

Use in a template

Validators attach to a field on a custom template. The cascade runs them after mapping but before commit; failures surface in the per-row validation report.

template.yaml
fields:
  - column: phone
    type: phone
    validators:
      - type: phone

Watch out

Common gotchas

  • No country detection. `0000000` passes — only shape and length are checked.
  • No E.164 normalisation. If you commit to FHIR, normalise first or downstream consumers see whatever the source had.
  • Total length cap is 20 characters; extensions like `x123` push some legitimate corporate numbers past the limit.
  • Opt-in `strict: true` swaps the regex for libphonenumber-js (min build). E.164 numbers that the library accepts pass; syntactically-similar invalids (e.g. `+411234`) fail. Pair with `countries: [CH, DE]` to lock to specific ISO-3166 codes — non-matching countries return `phone_country`. Default behavior is unchanged.

Where it runs

Three routes, no AI cost.

  • POST/v1/validate-rowValidate one row against a template. Stateless, no key, pure compute — the fastest way to try phone against a real value.no key
  • POST/v1/uploads/:id/validateRun every field validator over the parsed upload, without committing. Returns errors and warnings per row.read
  • POST/v1/uploads/:id/commitValidates on the way out. skip_invalid_rows drops the failures instead of failing the commit.commit

Validators are pure functions, so they add nothing to the AI bill. Every map draws a small flat per-map fee from your prepaid token wallet ($10 minimum, shared across the phi-cloud suite); only columns that reach the metered LLM layer, plus any-to-any convert and structural reshape, bill real AI tokens. See pricing

Catalogue

Related templates

  • Patient demographicspatient_demographics_v1

    Patient identity. Emits FHIR Patient.

    Fields · phone

  • Leadsleads_v1

    Sales leads: contact, source, status, and creation metadata.

    Fields · phone

  • Contactscontacts_v1

    People at named accounts: identity, contact details, role, decision-maker flag.

    Fields · phone

  • Customerscustomers_v1

    Repeat e-commerce buyers: identity, contact, default shipping, lifetime stats.

    Fields · phone

  • Candidatescandidates_v1

    Recruiting pipeline: applicant contact, role, and stage.

    Fields · phone

Explore

All 19 validator types

The complete list a template field can declare. There is no SNOMED validator — it required an affiliate licence, no template used it, and it was removed in 2026.

Ready when you are

Validate every row — before it lands.

Attach checksum-strict validators to any field, and gate risky commits behind the requires_hitl flag. One key runs the whole cascade.

Prepaid token wallet · schema-only data-minimization mode · no free tier
phone validator — AdaptivMapr