CLABE Validation

CLABE (Clave Bancaria Estandarizada, Spanish for "standardized bank code") number is an eighteen-digit number used to identify bank accounts in Mexico. It’s much like an IBAN code but for a Mexican bank account.

CLABE consists of 18 digits and contains the bank code (3 digits), branch office code (3 digits), bank account number (11 digits) and the control digit.

For example, CLABE number 002010077777777771:

When you send money using an invalid CLABE number, the bank should reverse the transaction and return the money, but this might take some time and your bank may charge you a fee. Using our flexible and fast RESTful API you can validate a routing number and receive all possible information about it - see whether it's valid and which bank, province and branch it belongs to, as well as branch city, address and postcode.

How to validate a CLABE number

To start using our SWIFT codes API sign up here and create your API key. Pass this key either via x-api-key HTTP header or via api_key query param.

To validate a routing number call /v1/clabes/{clabe_number} endpoint using HTTP client of your preference, i.e.:

curl 'https://swiftcodesapi.com/v1/clabes/002010077777777771' \
    --header 'X-Api-Key: your-api-key-here' \
    --header 'Accept: application/json'
# INSTALLATION
$ composer require guzzlehttp/guzzle
# REQUEST
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://swiftcodesapi.com/v1/clabes/002010077777777771', [
    'headers' => [
        'Accept' => 'application/json',
        'X-Api-Key' => 'your-api-key-here',
    ],
]);

echo $response->getBody();
# INSTALLATION
$ python -m pip install requests
# REQUEST
import requests

url = "https://swiftcodesapi.com/v1/clabes/002010077777777771"

headers = {
    "Accept": "application/json",
    "X-Api-Key": "your-api-key-here"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
# INSTALLATION
$ npm install node-fetch --save
// REQUEST
const fetch = require('node-fetch');

const url = 'https://swiftcodesapi.com/v1/clabes/002010077777777771';
const options = {method: 'GET', headers: {'Accept': 'application/json', 'X-Api-Key': 'your-api-key-here'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));)
const options = {method: 'GET', headers: {'Accept': 'application/json', 'X-Api-Key': 'your-api-key-here'}};

fetch('https://swiftcodesapi.com/v1/clabes/002010077777777771', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

The response should be:

{
    "success": true,
    "data": {
        "id": "002010077777777771",
        "account_number": "07777777777",
        "bank": {
            "id": "60ad62b6-26cf-4686-960b-e06219e0e0b1",
            "country_id": "MX",
            "code": "002",
            "name": "Banco Nacional de México"
        },
        "cities": [
            {
                "id": "80c7c515-a340-49ed-b3fe-4cef261451c4",
                "country_id": "MX",
                "name": "Aguascalientes"
            }
        ]
    }
}

You can find full documentation here.