Official BankLink SDK for Python
Project description
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
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
banklink-0.1.0.tar.gz
(5.2 kB
view details)
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 banklink-0.1.0.tar.gz.
File metadata
- Download URL: banklink-0.1.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5f50f030ca2dd38b1d38d63194d3bb8a04a5653d0714085ba454ffb4a21416c
|
|
| MD5 |
90bf7d342238ed0aaced4bce9f089395
|
|
| BLAKE2b-256 |
afdae71f187d61679e664bfed19cfd26540dc674f1f3c83adb5a24b7808b0dfe
|
File details
Details for the file banklink-0.1.0-py3-none-any.whl.
File metadata
- Download URL: banklink-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bda9eb7f3379f8cfb210dc0f5d7c11bee8da8898667ce9fa0ccae9df90273b2
|
|
| MD5 |
e8e682156b02ae9fb60b2df567f73808
|
|
| BLAKE2b-256 |
9c23c9c0de3cdc084483c4e3107ce43bcc4cec8de1d226586f63a878dfdbc77a
|