🏦 BankKit
Python SDK for validating banking data — built for Latin America, ready for the world.
BankKit validates banking identifiers, account numbers, documents, and financial keys across Latin America and international standards — no API calls, no dependencies, just fast and reliable validation.
Why BankKit?
Most validation libraries are built for Europe. BankKit was built with Latin America first — covering Brazil, Mexico, Argentina, and Chile — while also supporting global standards like IBAN, SWIFT, and card numbers.
Installation
pip install bankkit
Quick Start
from bankkit import BankKit
bk = BankKit()
# Validate a PIX key
bk.validate_pix("11122233344")
# → {"valid": True, "type": "CPF", "error": None}
# Validate an IBAN
bk.validate_iban("GB82WEST12345698765432")
# → {"valid": True, "country": "United Kingdom", "code": "GB", "error": None}
# Validate a passport
bk.validate_passport("AB123456", "BR")
# → {"valid": True, "country": "BR", "format": "2 letters + 6 digits", "error": None}
Features
🇧🇷 Brazil
| Function | What it validates | Standard |
|---|---|---|
validate_cpf(cpf) |
CPF check digit | Receita Federal |
validate_cnpj(cnpj) |
CNPJ check digit | Receita Federal |
validate_pix(key) |
PIX key by type (CPF, CNPJ, email, phone, UUID) | BACEN |
validate_br_account(agency, account, code?) |
Bank account + optional bank lookup | BACEN / COMPE |
🇦🇷 Argentina
| Function | What it validates | Standard |
|---|---|---|
validate_cbu(cbu) |
CBU/CVU (22 digits, dual block check) | BCRA |
🇲🇽 Mexico
| Function | What it validates | Standard |
|---|---|---|
validate_clabe(clabe) |
CLABE (18 digits, weighted check digit) | BANXICO |
🇨🇱 Chile
| Function | What it validates | Standard |
|---|---|---|
validate_rut(rut) |
RUT — accepts formats like "12.345.678-5" or "K" | SII |
🇺🇸 United States
| Function | What it validates | Standard |
|---|---|---|
validate_routing(routing) |
ABA Routing Number + Federal Reserve district | ABA |
🇨🇦 Canada
| Function | What it validates | Standard |
|---|---|---|
validate_ca_routing(routing) |
Routing number (transit + institution) | Payments Canada |
validate_ca_account(account) |
Account number format | Payments Canada |
🌍 International
| Function | What it validates | Standard |
|---|---|---|
validate_iban(iban) |
IBAN format + MOD 97 checksum (80+ countries) | ISO 13616 |
validate_swift(swift) |
SWIFT/BIC format + country code | ISO 9362 |
validate_card(number) |
Card number + brand detection (Luhn) | ISO 7812 |
validate_bin(bin) |
BIN (first 6 digits) + brand detection | ISO 7812 |
validate_passport(number, country) |
Passport format by country (30+ countries) | ICAO 9303 |
Usage Examples
Brazil
# CPF
bk.validate_cpf("111.444.777-35")
# → {"valid": True, "error": None}
# CNPJ
bk.validate_cnpj("11.222.333/0001-81")
# → {"valid": True, "error": None}
# PIX — auto-detects key type
bk.validate_pix("user@email.com")
# → {"valid": True, "type": "EMAIL", "error": None}
bk.validate_pix("+5511999999999")
# → {"valid": True, "type": "PHONE", "error": None}
# Bank account with optional bank code
bk.validate_br_account("0001", "123456", code="341")
# → {"valid": True, "bank": "Itaú Unibanco", "error": None}
Latin America
# Argentina — CBU
bk.validate_cbu("0720599600000057836902")
# → {"valid": True, "bank": None, "error": None}
# Mexico — CLABE
bk.validate_clabe("032180000118359719")
# → {"valid": True, "bank_code": "032", "bank": "IXE Banco", "error": None}
# Chile — RUT
bk.validate_rut("76.354.771-K")
# → {"valid": True, "error": None}
North America
# USA — ABA Routing Number
bk.validate_routing("021000021")
# → {"valid": True, "district": "New York", "error": None}
# Canada — Routing Number
bk.validate_ca_routing("000011001")
# → {"valid": True, "institution": "001", "bank": "Bank of Montreal (BMO)", "error": None}
# Canada — Account
bk.validate_ca_account("12345678")
# → {"valid": True, "error": None}
International
# IBAN
bk.validate_iban("GB82WEST12345698765432")
# → {"valid": True, "country": "United Kingdom", "code": "GB", "error": None}
# SWIFT/BIC
bk.validate_swift("BRASBRRJXXX")
# → {"valid": True, "bank_code": "BRAS", "country": "BR", "error": None}
# Card number
bk.validate_card("4111111111111111")
# → {"valid": True, "brand": "Visa", "error": None}
# BIN
bk.validate_bin("636368")
# → {"valid": True, "brand": "Elo", "error": None}
# Passport
bk.validate_passport("AB123456", "BR")
# → {"valid": True, "country": "BR", "format": "2 letters + 6 digits", "error": None}
bk.validate_passport("A12345678", "US")
# → {"valid": True, "country": "US", "format": "1 letter + 8 digits", "error": None}
Accessing specific fields
result = bk.validate_iban("GB82WEST12345698765432")
result["country"] # → "United Kingdom"
result["code"] # → "GB"
result["valid"] # → True
Response Format
Every function returns a consistent dict:
{
"valid": bool, # always present
"error": str | None, # present when valid is False
# + additional fields depending on the validator
}
Standards & References
BankKit follows official specifications:
- IBAN → ISO 13616
- SWIFT/BIC → ISO 9362
- Card Numbers → ISO 7812 + Luhn Algorithm
- Passport → ICAO Doc 9303
- PIX / COMPE / ISPB → BACEN
- CLABE → BANXICO
- CBU/CVU → BCRA
- RUT → SII Chile
- ABA Routing → ABA
- CA Routing → Payments Canada
Contributing
Contributions are welcome — especially for expanding country coverage and bank data.
- Fork the repository
- Create your branch (
git checkout -b feat/add-colombia) - Add your validator in the correct folder (
validators/latam/validator_co.py) - Add tests (
tests/latam/test_co.py) - Open a Pull Request
Looking for ideas? Check issues labeled good first issue.
License
MIT © Otavio Vicario Muraca
Metadata
Release files for bankkit 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bankkit-0.1.3.tar.gz | 24.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bankkit-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.9 kB
Release files / bankkit-0.1.3.tar.gz
| Download URL | bankkit-0.1.3.tar.gz |
|---|---|
| Size | 24.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25551bf6d84e01aae04cbcf58a538ef4fc2ce8b109e336b8fdc72befa2d36a7a
|
|
BLAKE2b-256 checksum How to use checksums |
c31ba83e0ccc1df9643a201497f440f7b8087a483fb4ab1f373e08e262d8b929
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / bankkit-0.1.3-py3-none-any.whl
| Download URL | bankkit-0.1.3-py3-none-any.whl |
|---|---|
| Size | 33.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8192e6e66f42c86b1fd30735d7a8bdb56f6f0d71d72c9f06a2f6694f212dc2a0
|
|
BLAKE2b-256 checksum How to use checksums |
7a7ebf071d0471608d587891549c78eb684db6f12425918f3d7349ae5092e35f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for bankkit 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.