Validate CLABE
validate_clabeValidate a Mexican CLABE account number, verify the control digit using Banxico's correct algorithm, and get the bank name from the official participant catalogue.
Instructions
Validate an 18-digit CLABE (Clave Bancaria Estandarizada, Banxico Circular 3/2012) — the account number every SPEI transfer in Mexico is addressed to — and name the bank behind it.
Structure: 3 digits of bank + 3 of plaza (city/branch) + 11 of account + 1 control digit.
The control digit is the part everybody gets wrong. The weights cycle 3-7-1, and each weighted product counts only its last digit (the product modulo 10): 9 × 7 = 63 counts as 3. Implementations that borrow the Luhn habit of adding the product's digits (6 + 3 = 9) compute a different control digit — for the base 09000000000000000 the algorithm gives 7 and the Luhn-style sum gives 1. (Reducing modulo 10 before or after summing gives the same result; that is not where they go wrong.) This uses the correct algorithm.
The bank code is resolved against a curated subset of Banxico's participant catalogue. A code that is not in the subset is reported as unknown rather than given an invented name. The plaza code is reported verbatim: the full plaza catalogue is not bundled, so no city is guessed.
Args:
value (string): the CLABE. Spaces and dashes are normalised away.
response_format ('markdown' | 'json'): output format (default 'markdown').
Returns: { input, normalized, formatted, valid, parts{banco, plaza, cuenta, digito}, bank_code, bank_name, plaza_code, plaza_note, expected_check_digit, errors[{code, message}], findings[] }.
Example: "Which bank is CLABE 012180012345678903?" -> validate_clabe(value="012180012345678903").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes | The CLABE to validate, e.g. '012180012345678903'. | |
| response_format | No | Output format: 'markdown' for a human-readable summary (default) or 'json' for the full structured payload. | markdown |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | ||
| parts | Yes | ||
| valid | Yes | ||
| errors | Yes | ||
| findings | Yes | ||
| bank_code | Yes | ||
| bank_name | Yes | ||
| formatted | Yes | ||
| normalized | Yes | ||
| plaza_code | Yes | ||
| plaza_note | Yes | ||
| expected_check_digit | Yes |