# Mx clabe validate

`mx-clabe-validate` · version 1.0.0 · Identifiers & check digits · free, no key needed

Validate an 18-digit Mexican CLABE's weighted check digit and split it into bank, plaza and account fields.

**Use when you need to: validate a mexican clabe · check clabe check digit · is this a valid interbank clabe.**

## Decide before calling

Read the [versioned contract](/v1/tools/mx-clabe-validate/versions/1.0.0) and the supported scope below. Reuse `mx-clabe-validate@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `mx-clabe-validate@1.0.0` for validate a mexican clabe. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- validate a mexican clabe
- check clabe check digit
- is this a valid interbank clabe
- split a clabe into bank branch and account
- verify a spei clabe before sending money
- clabe checksum calculator

## Not supported

- looking up the bank name for a bank_code (no Banxico bank registry is pinned)
- computing a CLABE from a bank/plaza/account triple (this tool only validates)
- IBAN or ABA routing-number validation

## Behavior

- clabe is taken exactly as given: no trimming, no removal of spaces or hyphens, no case folding.
- If clabe.length is not 18, valid:false, reason:'wrong_length', bank_code:null, plaza_code:null, account_number:null, check_digit:null.
- Otherwise, if clabe does not match ^[0-9]{18}$, valid:false, reason:'invalid_character', with the same fields null.
- Otherwise bank_code = clabe[0:3], plaza_code = clabe[3:6], account_number = clabe[6:17], check_digit = clabe[17] (echoed as given). All four are populated from here on regardless of checksum validity.
- Expected check digit over the first 17 digits: weights cycle [3,7,1] starting at position 0; each digit is multiplied by its weight and reduced mod 10 (a per-position reduction, not a plain weighted sum); the 17 reduced values are summed (s); expected = (10 - (s mod 10)) mod 10.
- If check_digit differs from expected, valid:false, reason:'check_digit_mismatch'. Otherwise valid:true, reason:null. No bank-registry lookup: bank_code is returned as parsed even when unassigned.

## Input

- `clabe` (string, required): min length 1; max length 24

## Output

- `valid` (boolean, required)
- `reason` (one of null, "wrong_length", "invalid_character", "check_digit_mismatch", required)
- `bank_code` (string or null, required): pattern `^[0-9]{3}$`
- `plaza_code` (string or null, required): pattern `^[0-9]{3}$`
- `account_number` (string or null, required): pattern `^[0-9]{11}$`
- `check_digit` (string or null, required): pattern `^[0-9]$`

## Limits

- max clabe bytes: 24

## Example

Request input:

```json
{
  "clabe": "723010123456789019"
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "reason": null,
    "bank_code": "723",
    "plaza_code": "010",
    "account_number": "12345678901",
    "check_digit": "9"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "mx-clabe-validate",
  "version": "1.0.0",
  "input": {
    "clabe": "723010123456789019"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/mx-clabe-validate/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"clabe":"723010123456789019"}'
```

The machine-readable contract is at [/v1/tools/mx-clabe-validate/versions/1.0.0](/v1/tools/mx-clabe-validate/versions/1.0.0).

### CLI

```sh
node cli.mjs run mx-clabe-validate 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Iccid validate](/tools/iccid-validate): Validate a 19/20-digit ICCID's Luhn check digit, require the 89 major industry id, split issuer/account digits.
- [Upu s10 validate](/tools/upu-s10-validate): Validate a 13-char UPU S10 postal identifier's weighted mod-11 check digit, split service indicator and country.
- [Iban validate](/tools/iban-validate): Validate an IBAN's country, registry length, BBAN structure and MOD 97-10 check digits, and parse its bank/branch code.
- [Iso6346 container validate](/tools/iso6346-container-validate): Validate an 11-character ISO 6346 container number's mod-11 check digit and split the owner code, category and serial.
- [Imei validate](/tools/imei-validate): Validate a 15-digit IMEI's Luhn check digit or accept a 16-digit IMEISV, and split the TAC from the serial.
- [Imo number validate](/tools/imo-number-validate): Validate a 7-digit IMO ship identification number's weighted mod-10 check digit, with or without the 'IMO ' prefix.
