Official Python SDK for the IBANforge API — IBAN validation, BIC/SWIFT lookup, Swiss BC-Nummer, sanctions/SEPA/VoP compliance triage.
Project description
IBANforge Python SDK
Official Python SDK for the IBANforge API — IBAN validation, BIC/SWIFT lookup, Swiss BC-Nummer, and sanctions/SEPA/VoP compliance triage.
Built for AI finance agents and fintech developers. Sync + async clients, full type hints, typed exceptions.
Install
pip install ibanforge
Get a free API key (1 line, no signup form)
from ibanforge import IBANforge
key = IBANforge.generate_api_key("you@example.com")
print(key["api_key"]) # ifk_… — store it, it's shown only once
print(key["monthly_limit"]) # 200 free requests/month
When the monthly quota is exhausted, the API automatically falls back to advertising x402 payment requirements (no dead-end). Your key resumes working at the start of the next month.
Quick start (sync)
from ibanforge import IBANforge
with IBANforge(api_key="ifk_...") as client:
out = client.validate_iban("CH9300762011623852957")
print(out["valid"]) # True
print(out["country"]) # {"code": "CH", "name": "Switzerland"}
print(out["bic"]["bankName"]) # "UBS Switzerland AG"
print(out["bic"]["lei"]) # "BFM8T61CT2L1QCEMIK50"
print(out["sepa"]) # {"reachable": True, "instant": True}
print(out["vop"]["participant"]) # True
print(out["ch_clearing"]["bc_nummer"]) # "762"
print(out["risk_score"]) # 5
Quick start (async)
import asyncio
from ibanforge import AsyncIBANforge
async def main():
async with AsyncIBANforge(api_key="ifk_...") as ibanforge:
# Fan out 100 validations concurrently
results = await asyncio.gather(*[
ibanforge.validate_iban(iban) for iban in ibans
])
valid = sum(1 for r in results if r["valid"])
print(f"{valid}/{len(results)} valid")
asyncio.run(main())
All endpoints
| Method | Cost | What it does |
|---|---|---|
format_iban(iban) |
free | Pure mod-97 + structure check. Use to pre-filter malformed IBANs before paying. |
validate_iban(iban) |
$0.005 | Full enrichment — BIC, country, EMI/vIBAN flag, SEPA + VoP, risk score, Swiss BC-Nummer for CH/LI |
validate_batch([iban, ...]) |
$0.002 / IBAN | Up to 100 IBANs in one call. CSV cleanup, payout list triage. |
lookup_bic(code) |
$0.003 | Resolve BIC/SWIFT into bank name, country, city, LEI, address. 121,197 GLEIF entries. |
lookup_ch_clearing(iid) |
$0.003 | Resolve a Swiss BC-Nummer / IID. The only API with this data. |
check_compliance(iban) |
$0.02 | Pre-flight risk triage: sanctions (OFAC/EU/UN), FATF, SEPA Instant, VoP, risk score 0-100, recommended_action ∈ {allow, review, block} |
usage() |
free | Current month quota usage for your key |
health() |
free | API version, BIC count, uptime |
Free format check (no key needed)
Save money by pre-filtering bad IBANs before paying for enrichment:
from ibanforge import IBANforge
with IBANforge() as client: # no api_key required
out = client.format_iban("CH9300762011623852957")
if not out["valid"]:
print("Skip:", out["error"]) # e.g. "checksum_failed"
else:
print(out["bban"]["bank_code"]) # "00762"
Compliance triage (the killer feature)
out = client.check_compliance("RU1234567890123456789012345678") # made-up RU
print(out["risk_score"]) # high (Russia + FATF flag)
print(out["recommended_action"]) # "block" | "review" | "allow"
print(out["sanctions"]["lists"]) # ["OFAC", "EU"] etc.
print(out["fatf"]["list"]) # "grey" | "black" | "none"
print(out["sepa"]["reachable"])
Error handling
The SDK raises typed exceptions — catch the specific class you care about, or the base IBANforgeError:
from ibanforge import (
IBANforge,
AuthError, PaymentRequiredError, QuotaExhaustedError,
RateLimitError, InvalidInputError, APIError, IBANforgeError,
)
with IBANforge(api_key="ifk_...") as client:
try:
out = client.validate_iban("not-an-iban")
except InvalidInputError as e:
print(e.body["error"]) # "invalid_format"
except AuthError:
print("Bad or revoked API key")
except PaymentRequiredError as e:
# Your quota is exhausted — switch to x402 to keep going
print(e.body["accepts"]) # x402 payment requirements
except RateLimitError:
print("Slow down")
except APIError as e:
print(f"Server error {e.status} — retry with backoff")
except IBANforgeError as e:
print(f"Other: {e}")
For LLM agents (LangChain, LlamaIndex, CrewAI, AutoGen)
The IBANforge API is also available as a native MCP server (npx -y ibanforge-mcp) and via x402 micropayments — see the agent guide. For Python-first agents, the SDK above is usually enough.
Configuration
client = IBANforge(
api_key="ifk_...",
base_url="https://api.ibanforge.com", # default
timeout=30.0, # seconds, default
user_agent="my-app/1.2", # custom UA
)
Links
- API documentation: https://ibanforge.com/docs
- Interactive OpenAPI: https://ibanforge.com/openapi
- Agent guide: https://ibanforge.com/agents
- TypeScript SDK:
@ibanforge/sdk - MCP server:
ibanforge-mcp - Source: https://github.com/cammac-creator/ibanforge
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ibanforge-1.1.0.tar.gz.
File metadata
- Download URL: ibanforge-1.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad0a30896454326dd4b7815be67392eba26ce3e8c37cbe0ee64bc72aeb98fa44
|
|
| MD5 |
2c2b7a7a036f63f32a74f920b1812ebe
|
|
| BLAKE2b-256 |
801f8b6d90c304ca3da3767414a45dd9caf9d32a6343046da810d565c6697866
|
File details
Details for the file ibanforge-1.1.0-py3-none-any.whl.
File metadata
- Download URL: ibanforge-1.1.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
405af59dc850301b4c10e492e1220065025699d4522d9df18d82e3274a0639af
|
|
| MD5 |
00122dbed71448d43c851149dff562a0
|
|
| BLAKE2b-256 |
5a73481fadf98c400940ccfbd0b6425eca0f35eff044abf59114e97f9f4c70b9
|