Docs · Validators
phone validator
Lightweight pattern check for phone-like strings. No country logic.
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.
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.
fields:
- column: phone
type: phone
validators:
- type: phoneWatch 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_rowsdrops 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 demographics
patient_demographics_v1Patient identity. Emits FHIR Patient.
Fields ·
phone - Leads
leads_v1Sales leads: contact, source, status, and creation metadata.
Fields ·
phone - Contacts
contacts_v1People at named accounts: identity, contact details, role, decision-maker flag.
Fields ·
phone - Customers
customers_v1Repeat e-commerce buyers: identity, contact, default shipping, lifetime stats.
Fields ·
phone - Candidates
candidates_v1Recruiting 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.
- phone
- regex
- enum
- date_range
- number_range
- url
- iban
- bic
- uuid
- gtin
- pharmacode
- fhir_reference
- loinc_code
- icd10_code
- atc_code
- cpt_code
- npi
- gln
Back to the documentation index or browse the template catalogue.
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.