Version 0.1.0. Requires the Saman Mobillet HTTP service; it does not connect directly to the bank.
Every endpoint returns the complete JSON object as a dictionary, including unknown fields. A missing field is not synthesized. Identifiers and OTP codes must remain strings; amounts are integer IRR. Do not print private responses in public logs.
Client(base_url=None, api_key=None, timeout=120, max_response_bytes=20971520, transport=None, trust_env=False) reads SAMAN_API_URL and SAMAN_API_KEY when omitted. Use a context manager to close connection pools. AsyncClient supports async with and await for the same methods. The service owns one shared bank session.
sign_in() collects username, hidden password and the server-requested SMS code. Supply otp_callback for automation; AsyncClient also accepts an async callback. Use login() and verify_otp() for separate web form steps. No credentials are persisted by the SDK.
HTTP: GET /v1/accounts/categories. CLI: saman-api account-categories.
account_categories() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/accounts. CLI: saman-api accounts.
accounts() -> 'JSONResponse'Deposit list (alias of deposits).
HTTP: GET /v1/accounts/with-cards. CLI: saman-api accounts-with-cards.
accounts_with_cards() -> 'JSONResponse'Deposits with attached cards, as supplied by the bank.
HTTP: POST /v1/digital-rial/wallets. CLI: saman-api activate-digital-rial.
activate_digital_rial(verification_code: 'str', *, wallet_type: 'str' = 'CUSTOMER') -> 'JSONResponse'Activate a real CUSTOMER wallet using its separate activation SMS.
HTTP: GET /v1/cards/all. CLI: saman-api all-cards.
all_cards() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/deposits/all. CLI: saman-api all-deposits.
all_deposits() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/balance. CLI: saman-api balance.
balance() -> 'JSONResponse'Reported card/deposit balances; missing balances remain null, not zero.
HTTP: GET /v1/balances. CLI: saman-api balances.
balances() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/capabilities. CLI: saman-api capabilities.
capabilities() -> 'JSONResponse'List CLI-to-HTTP capabilities supported by the server.
HTTP: GET /v1/balances/cards. CLI: saman-api card-balances.
card_balances() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: POST /v1/transfers/card/owner. CLI: saman-api card-owner.
card_owner(source: 'str', destination: 'str') -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/cards. CLI: saman-api cards.
cards() -> 'JSONResponse'Complete card records, including unknown bank fields.
HTTP: GET /v1/cartable/count. CLI: saman-api cartable-count.
cartable_count() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: POST /v1/digital-rial/wallets/{walletId}/charge. CLI: saman-api charge-digital-rial.
charge_digital_rial(wallet_id: 'str', deposit_number: 'str', amount: 'int', *, request_id: 'str | None' = None) -> 'JSONResponse'Move real funds from deposit to wallet; encryption is handled by the server.
HTTP: POST /v1/auth/session/check. CLI: saman-api check-session.
check_session() -> 'JSONResponse'Check the current session with the bank without starting a new login.
close() -> 'None'Release connection pools; does not log out the bank session.
HTTP: POST /v1/config. CLI: saman-api configure.
configure() -> 'JSONResponse'Negotiate bank encryption keys; login normally handles this automatically.
HTTP: POST /v1/digital-rial/wallets/{walletId}/deactivate. CLI: saman-api deactivate-digital-rial.
deactivate_digital_rial(wallet_id: 'str', *, deposit_number: 'str | None' = None, request_id: 'str | None' = None) -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/balances/deposits. CLI: saman-api deposit-balances.
deposit_balances() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/deposits/categories. CLI: saman-api deposit-categories.
deposit_categories() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/owner/deposit/{number}. CLI: saman-api deposit-owner.
deposit_owner(deposit_number: 'str') -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/deposits. CLI: saman-api deposits.
deposits() -> 'JSONResponse'Complete deposit records; no card collection is mixed into the list.
HTTP: GET /v1/digital-rial/wallets/{walletId}/balance. CLI: saman-api digital-rial-balance.
digital_rial_balance(wallet_id: 'str') -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/digital-rial/contacts. CLI: saman-api digital-rial-contacts.
digital_rial_contacts(*, size: 'int' = 120) -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/digital-rial/transactions/{id}. CLI: saman-api digital-rial-transaction-detail.
digital_rial_transaction_detail(transaction_id: 'str') -> 'JSONResponse'Wallet transaction ID; this is not a deposit-history transaction ID.
HTTP: GET /v1/digital-rial/wallets/{walletId}/transactions. CLI: saman-api digital-rial-transactions.
digital_rial_transactions(wallet_id: 'str', *, page: 'int' = 0, size: 'int' = 10) -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/digital-rial/wallets. CLI: saman-api digital-rial-wallets.
digital_rial_wallets(*, page: 'int' = 0, size: 'int' = 10, wallet_states: 'Sequence[str] | None' = None, wallet_types: 'Sequence[str] | None' = None) -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: POST /v1/digital-rial/wallets/{walletId}/discharge. CLI: saman-api discharge-digital-rial.
discharge_digital_rial(wallet_id: 'str', deposit_number: 'str', amount: 'int', *, request_id: 'str | None' = None) -> 'JSONResponse'Move real funds from wallet to deposit; never retries a submission.
HTTP: POST /v1/auth/session/ensure. CLI: saman-api ensure-session.
ensure_session(username: 'str | None' = None, password: 'str | None' = None) -> 'JSONResponse'Check/renew using explicit or server-environment credentials; may require OTP.
HTTP: GET /v1/deposits/favorites. CLI: saman-api favorite-deposits.
favorite_deposits() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/transactions/find/{code}. CLI: saman-api find-transaction.
find_transaction(code: 'str', deposit_number: 'str | None' = None, *, match_by: 'str' = 'any', pages: 'int' = 10, max_transactions: 'int' = 200, page: 'int' = 0, size: 'int' = 20, from_date: 'int | None' = None, to_date: 'int | None' = None, from_amount: 'str | int | None' = None, to_amount: 'str | int | None' = None, query: 'str | None' = None, is_withdrawal: 'bool | None' = None) -> 'JSONResponse'Exact tracking/reference search. Inspect searchComplete and stopReason when not found.
HTTP: GET /v1/health. CLI: saman-api health.
health() -> 'JSONResponse'Check service liveness, without contacting the bank.
HTTP: GET /v1/home. CLI: saman-api home.
home() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/accounts/{number}/iban. CLI: saman-api iban.
iban(account_number: 'str') -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/owner/iban/{iban}. CLI: saman-api iban-owner.
iban_owner(iban: 'str') -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: POST /v1/auth/import-har. CLI: saman-api import-har.
import_har(har: 'Mapping[str, Any]') -> 'JSONResponse'Import a caller-supplied HAR object; the server never replays it.
import_har_file(path: 'str | Path') -> 'JSONResponse'Read a private HAR locally and send its JSON to your API server.
HTTP: GET /v1/institutions. CLI: saman-api institutions.
institutions(*, title: 'str | None' = None, offset: 'int' = 0, length: 'int' = 10) -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
iter_transactions(deposit_number: 'str | None' = None, *, start_page: 'int' = 0, size: 'int' = 100, max_pages: 'int' = 10, details: 'bool' = False) -> 'Iterator[JSONResponse]'Yield full row objects; raise PaginationError if a page repeats or the budget is exhausted.
HTTP: GET /v1/transactions/latest. CLI: saman-api latest-transactions.
latest_transactions(deposit_number: 'str | None' = None, *, limit: 'int' = 10, details: 'bool' = True) -> 'JSONResponse'Always page zero; the service verifies the selected deposit.
HTTP: GET /v1/transfers/latest. CLI: saman-api latest-transfer.
latest_transfer() -> 'JSONResponse'Latest transfer-source metadata, not latest transaction history.
HTTP: POST /v1/auth/login. CLI: saman-api login.
login(username: 'str', password: 'str', *, login_type: 'str' = 'STATIC', request_otp: 'bool' = True) -> 'JSONResponse'Start login. API >=0.3 requests device SMS automatically if needed.
HTTP: POST /v1/auth/logout. CLI: saman-api logout.
logout() -> 'JSONResponse'Clear the API server's local bank session, affecting all its consumers.
HTTP: GET /v1/merchant/summary. CLI: saman-api merchant-summary.
merchant_summary(terminal_id: 'str', *, from_date: 'int | None' = None) -> 'JSONResponse'from_date is Unix milliseconds; omission selects the service's last-30-days default.
HTTP: GET /v1/merchant/terminals. CLI: saman-api merchant-terminals.
merchant_terminals() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/notifications/count. CLI: saman-api notifications-count.
notifications_count() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/onboarding/latest. CLI: saman-api onboarding.
onboarding() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/opening-account/customer. CLI: saman-api opening-account-customer.
opening_account_customer() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/opening-account/terms. CLI: saman-api opening-account-terms.
opening_account_terms() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/profile. CLI: saman-api profile.
profile() -> 'JSONResponse'Complete bank user-profile response.
HTTP: GET /v1/cards/recent. CLI: saman-api recent-cards.
recent_cards(amount: 'int') -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/deposits/recent. CLI: saman-api recent-deposits.
recent_deposits(amount: 'int') -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/ibans/recent. CLI: saman-api recent-ibans.
recent_ibans(amount: 'int') -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/transfers/recent/{kind}. CLI: saman-api recent-transfer-destinations.
recent_transfer_destinations(kind: 'str', amount: 'int') -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
request(method: 'str', path: 'str', *, query: 'Mapping[str, Any] | None' = None, body: 'Mapping[str, Any] | None' = None) -> 'JSONResponse'Call a relative API route once. Preserve every field of its JSON response.
HTTP: POST /v1/digital-rial/activation/otp. CLI: saman-api request-digital-rial-otp.
request_digital_rial_otp() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: POST /v1/auth/otp/request. CLI: saman-api request-otp.
request_otp() -> 'JSONResponse'Explicitly request/resend the device-verification SMS.
HTTP: POST /v1/transfers/card/otp. CLI: saman-api request-transfer-otp.
request_transfer_otp(source: 'str', destination: 'str', amount: 'int') -> 'JSONResponse'Request card-transfer PIN2 SMS; distinct from device verification.
HTTP: GET /v1/samanium. CLI: saman-api samanium.
samanium() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
sign_in(username: 'str | None' = None, password: 'str | None' = None, *, otp_callback: 'Callable[[], str] | None' = None, username_callback: 'Callable[[], str] | None' = None, password_callback: 'Callable[[], str] | None' = None) -> 'JSONResponse'Interactive login/resume. Use login/verify_otp for a web-service state machine.
Callback inputs are never logged or saved. resend at the OTP prompt
requests another code without replacing the pending device session.
HTTP: GET /v1/auth/session. CLI: saman-api status.
status() -> 'JSONResponse'Read local session state; bankVerified is not implied.
HTTP: GET /v1/transactions/detail/{id}. CLI: saman-api transaction.
transaction(transaction_id: 'str') -> 'JSONResponse'Legacy detail-route alias; same bank response as transaction_detail.
HTTP: GET /v1/transactions/categories. CLI: saman-api transaction-categories.
transaction_categories() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/transactions/{id}. CLI: saman-api transaction-detail.
transaction_detail(transaction_id: 'str') -> 'JSONResponse'Full receipt/counterparty response. The ID is one opaque URL-encoded segment.
HTTP: GET /v1/transactions/types. CLI: saman-api transaction-types.
transaction_types() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: GET /v1/transactions. CLI: saman-api transactions.
transactions(deposit_number: 'str | None' = None, *, page: 'int' = 0, size: 'int' = 10, details: 'bool' = True, from_date: 'int | None' = None, to_date: 'int | None' = None, from_amount: 'str | int | None' = None, to_amount: 'str | int | None' = None, query: 'str | None' = None, is_withdrawal: 'bool | None' = None) -> 'JSONResponse'Read one zero-based page. Dates are Unix seconds; detail enrichment defaults on.
HTTP: POST /v1/transfers/card. CLI: saman-api transfer-card.
transfer_card(source: 'str', destination: 'str', amount: 'int', *, cvv2: 'str', pin2: 'str', expire_date: 'str', transaction_pin: 'str | None' = None, description: 'str | None' = None, tracker_id: 'str | None' = None, is_most_referred_destination: 'bool | None' = None) -> 'JSONResponse'Submit one real card transfer. amount is integer IRR; expiry is Jalali YYYYMM.
HTTP: POST /v1/transfers/deposit. CLI: saman-api transfer-deposit.
transfer_deposit(source: 'str', destination: 'str', amount: 'int', *, transaction_pin: 'str | None' = None, description: 'str | None' = None, tracker_id: 'str | None' = None, is_most_referred_destination: 'bool | None' = None) -> 'JSONResponse'Submit one real account-to-account DEPOSIT transfer.
HTTP: POST /v1/transfers/iban. CLI: saman-api transfer-iban.
transfer_iban(source: 'str', destination: 'str', amount: 'int', reason_code: 'str', *, transaction_pin: 'str | None' = None, description: 'str | None' = None, tracker_id: 'str | None' = None, is_most_referred_destination: 'bool | None' = None) -> 'JSONResponse'Submit one real PAYA transfer. Source is a deposit, destination is an IBAN.
HTTP: GET /v1/transfers/reasons. CLI: saman-api transfer-reasons.
transfer_reasons() -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: POST /v1/digital-rial/activation/validate. CLI: saman-api validate-digital-rial.
validate_digital_rial(*, wallet_type: 'str' = 'CUSTOMER') -> 'JSONResponse'Return the complete JSON response from the corresponding HTTP endpoint.
HTTP: POST /v1/auth/otp. CLI: saman-api verify-otp.
verify_otp(code: 'str') -> 'JSONResponse'Complete device verification with an SMS code string.
All SDK exceptions derive from SamanError. ApiError preserves status_code, code, bank_status, auth, next_action and the entire payload. AuthenticationError, DeviceVerificationRequired, PasswordChangeRequired and SmsDeliveryError describe login steps. ValidationError and BankError describe HTTP and bank failures. ProtocolError means the server response cannot be used. TransportError indicates a connection failure; request_may_have_succeeded is true for writes, which must be reconciled before manually retrying. PaginationError means the requested bounded traversal could not be completed. Exception messages omit response payloads and credentials.
The complete endpoint request and response schema is available in the service openapi.json and API.md. Run saman-api COMMAND --help for exact CLI arguments. All endpoint methods use hyphenated command names. Responses remain JSON; the CLI does not flatten lists, balance fields or transaction detail objects.