Validate CLABE
validate_clabeValidate an 18-digit Mexican CLABE used for SPEI transfers, check its control digit correctly, and identify the bank behind it.
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 is reduced modulo 10 before being added to the sum. Implementations that sum the products first — the Luhn habit — accept and reject the wrong numbers. 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 |