Docs · Validators

iban validator

Format + mod-97 checksum, with optional country allow-list.

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

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.

lib/validators.ts
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.

template.yaml
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_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

  • Employee rosteremployee_roster_v1

    Names, AHV/GLN, contract type, address.

    Fields · iban

  • Supplier inventorysupplier_inventory_v1

    Supplier catalogue with GTIN/IBAN/GLN.

    Fields · iban

  • Bank accountsbank_accounts_v1

    Bank account details with IBAN/BIC validation.

    Fields · iban

  • Employeesemployees_v1

    Employee master records with identity, contact, and bank details. Contains PII.

    Fields · iban

  • Payrollpayroll_v1

    Payroll 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.

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
iban validator — AdaptivMapr