Docs · Validators
iban validator
Format + mod-97 checksum, with optional country allow-list.
Reference
Format
Strips whitespace and uppercases, then matches `/^[A-Z]{2}\d{2}[A-Z0-9]{11,30}$/`. If `countries` is set, the 2-letter prefix must be in that list. Final step is the standard IBAN mod-97 = 1 check, computed in 7-char chunks (no BigInt, edge-worker safe).
Examples
- CH93 0076 2011 6238 5295 7 (CH, 21 chars)
- DE89 3704 0044 0532 0130 00 (DE, 22 chars)
- GB82 WEST 1234 5698 7654 32 (GB, 22 chars, alpha bank code)
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 validIban(value, params) {
const v = value.replace(/\s+/g, '').toUpperCase()
if (!/^[A-Z]{2}\d{2}[A-Z0-9]{11,30}$/.test(v)) return fail('iban_format', 'bad IBAN format')
const countries = Array.isArray(params.countries) ? params.countries : null
if (countries && !countries.includes(v.slice(0, 2))) {
return fail('iban_country', `country ${v.slice(0, 2)} not allowed`)
}
const rearranged = v.slice(4) + v.slice(0, 4)
const expanded = rearranged.replace(/[A-Z]/g, (c) => String(c.charCodeAt(0) - 55))
let mod = 0
for (let i = 0; i < expanded.length; i += 7) {
mod = Number(`${mod}${expanded.slice(i, i + 7)}`) % 97
}
return mod === 1 ? OK : fail('iban_checksum', 'IBAN checksum failed')
}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: iban
type: string
validators:
- type: iban
countries: [CH, LI, DE, FR, IT]Watch out
Common gotchas
- Country length is enforced only via the global 4–32 char total (`[A-Z0-9]{11,30}` after the 4-char prefix). Swiss IBANs are 21 chars, German 22, Maltese 31 — the validator does not enforce per-country length.
- Whitespace is stripped before checksum; case is normalised. `"ch93 0076..."` works.
- No bank-code lookup. A syntactically valid IBAN can still point at a closed account.
- Opt-in `strict: true` enforces per-country length against the SWIFT IBAN Registry (CH=21, DE=22, FR=27, GB=22, MT=31, …) in addition to the mod-97 checksum. A wrong length returns `iban_length`; an unrecognised country prefix returns `iban_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 iban 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
- Employee roster
employee_roster_v1Names, AHV/GLN, contract type, address.
Fields ·
iban - Supplier inventory
supplier_inventory_v1Supplier catalogue with GTIN/IBAN/GLN.
Fields ·
iban - Bank accounts
bank_accounts_v1Bank account details with IBAN/BIC validation.
Fields ·
iban - Employees
employees_v1Employee master records with identity, contact, and bank details. Contains PII.
Fields ·
iban - Payroll
payroll_v1Payroll runs: gross salary, pay period, payout bank details. Contains sensitive PII.
Fields ·
iban
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.
- iban
- regex
- enum
- date_range
- number_range
- phone
- url
- 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.