BankLink Python SDK
Official Python SDK for the BankLink Open Finance API. Link South African bank accounts, ingest transactions, and deliver them anywhere.
Install
pip install banklink
Quick Start
from banklink import BankLink
client = BankLink(api_key="bl_live_...")
# List all linked accounts
accounts = client.accounts.list()
for account in accounts.data:
print(account.id, account.bank, account.account_number)
# Fetch a single page of transactions
page = client.transactions.list("acc_123", limit=50)
for txn in page.data:
print(txn.date, txn.description, txn.amount, txn.direction)
# Auto-paginate through all transactions
for txn in client.transactions.list_auto_paginate("acc_123"):
print(txn.date, txn.amount)
# Get account balance
balance = client.balances.get("acc_123")
print(balance.balance, balance.currency)
# Trigger an on-demand sync
result = client.accounts.sync("acc_123")
print(f"Synced {result.synced} transactions, skipped {result.skipped}")
Async Support
import asyncio
from banklink import AsyncBankLink
async def main():
async with AsyncBankLink(api_key="bl_live_...") as client:
accounts = await client.accounts.list()
for account in accounts.data:
print(account.id, account.bank)
# Async auto-pagination
async for txn in client.transactions.list_auto_paginate("acc_123"):
print(txn.date, txn.amount)
asyncio.run(main())
Bank Linking
from banklink import BankLink
client = BankLink(api_key="bl_live_...")
# Initiate a link flow
result = client.link.create(
bank_id="fnb",
credentials={"username": "your_username", "password": "your_password"},
nickname="My FNB Account",
)
if result.type == "otp_required":
# Submit OTP if required
result = client.link.submit_otp(
session_token=result.session_token,
otp="123456",
)
print("Linked:", result.profile_id, result.account_number)
Error Handling
from banklink import BankLink, AuthenticationError, NotFoundError, RateLimitError, BankLinkError
client = BankLink(api_key="bl_live_...")
try:
account = client.accounts.get("acc_does_not_exist")
except AuthenticationError:
print("Invalid or missing API key")
except NotFoundError:
print("Account not found")
except RateLimitError:
print("Rate limit exceeded — back off and retry")
except BankLinkError as e:
print(f"API error {e.status}: [{e.code}] {e.message}")
Configuration
from banklink import BankLink
client = BankLink(
api_key="bl_live_...",
base_url="https://api.banklink.co.za/v1", # default
timeout=30.0, # seconds, default 30
)
Use the context manager to ensure connections are closed:
with BankLink(api_key="bl_live_...") as client:
accounts = client.accounts.list()
Requirements
- Python 3.9+
- httpx >= 0.24 (installed automatically)
License
MIT — Copyright (c) 2026 Aurvex Labs
Metadata
Release files for banklink 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| banklink-0.1.0.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| banklink-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.0 kB
Release files / banklink-0.1.0.tar.gz
| Download URL | banklink-0.1.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5f50f030ca2dd38b1d38d63194d3bb8a04a5653d0714085ba454ffb4a21416c
|
|
BLAKE2b-256 checksum How to use checksums |
afdae71f187d61679e664bfed19cfd26540dc674f1f3c83adb5a24b7808b0dfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / banklink-0.1.0-py3-none-any.whl
| Download URL | banklink-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bda9eb7f3379f8cfb210dc0f5d7c11bee8da8898667ce9fa0ccae9df90273b2
|
|
BLAKE2b-256 checksum How to use checksums |
9c23c9c0de3cdc084483c4e3107ce43bcc4cec8de1d226586f63a878dfdbc77a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|