Crate akahu_client

Crate akahu_client 

Source
Expand description

§akahu-client

A non-official Rust client library for the Akahu API, providing access to financial data aggregation services in New Zealand.

§Features

  • Fetch user accounts and account details
  • Retrieve transactions with pagination support
  • Access user identity and profile information
  • Type-safe API with strongly-typed models
  • Async/await support using tokio
  • Comprehensive error handling

§Quick Start

use akahu_client::{AkahuClient, UserToken};

// Create a client with your app token
let client = AkahuClient::new(
    reqwest::Client::new(),
    "app_token_...".to_string(),
    None
);

// Create a user token from OAuth flow
let user_token = UserToken::new("user_token_...".to_string());

// Fetch accounts
let accounts = client.get_accounts(&user_token).await?;

for account in accounts.items {
    println!("{}: {:?} - {:.2}",
        account.name,
        account.kind,
        account.balance.current
    );
}

§Authentication

The Akahu API requires two types of tokens:

  • App Token: Identifies your application (obtained from Akahu dashboard)
  • User Token: Identifies the user whose data you’re accessing (obtained via OAuth flow)

Structs§

Account
An Akahu account is something that has a balance. Some connections (like banks) have lots of accounts, while others (like KiwiSaver providers) may only have one. Different types of accounts have different attributes and abilities, which can get a bit confusing! The rest of this page should help you figure everything out, from an account’s provider to whether it can make payments.
AccountId
Account identifier (always prefixed with acc_).
AccountMetadata
This is a less defined part of our API that lets us expose data that may be specific to certain account types or financial institutions. An investment provider, for example, may expose a breakdown of investment results.
Address
Address information from financial institution
AddressComponents
Structured address components
AkahuClient
The main Akahu API client.
AppSecret
Application secret for app-scoped endpoints.
AppToken
Application ID token for authenticating your app with Akahu.
AuthCode
OAuth authorization code (short-lived, valid for ~60 seconds).
AuthorizationId
Authorization identifier (always prefixed with auth_).
BalanceDetails
The account balance.
BankAccountNumber
A validated New Zealand bank account number.
BranchInfo
Bank branch information
CategoryId
Category identifier (always prefixed with cat_).
ClientSecret
OAuth client secret used during the token exchange flow.
ConnectionId
Connection identifier (always prefixed with conn_).
Cursor
Pagination cursor token.
CursorObject
Cursor for paginating through transaction results.
EnrichedTransactionData
This is data added by the Akahu enrichment engine. You must have additional permissions to view this data.
ErrorResponse
Standard error response structure from Akahu API
Identity
Identity item containing account holder information
IdentityAccount
Account information from identity verification
IdentityProfile
OAuth profile information
IdentitySource
Information about the institution connection
InterestDetails
Interest rate information for a loan.
InvalidBankAccountError
Error when a bank account number is invalid
InvalidEmailError
Error when an email address is invalid
InvalidIdError
Error when an ID doesn’t have the expected prefix
ItemResponse
Standard API response wrapper for a single item.
ListResponse
Standard API response wrapper for a list of items.
LoanDetails
Detailed information related to a loan account.
MerchantId
Merchant identifier (always prefixed with _merchant).
NameVerification
Boolean flags for name component verification
PaginatedResponse
Standard API response wrapper for paginated items.
Party
Party information from enduring access
PaymentDetails
Details for making a payment to an account that is not a bank account.
PaymentId
Payment identifier.
PendingTransaction
A pending transaction that has not yet been settled.
PersonalFinanceGroup
Personal finance category group.
RedirectUri
OAuth redirect URI used during the authorization flow.
RefreshDetails
Akahu can refresh different parts of an account’s data at different rates. The timestamps in the refreshed object tell you when that account data was last updated.
RepaymentDetails
Loan repayment information.
Transaction
A transaction is a record of money moving between two accounts. Akahu can provide transaction data from connected accounts for all bank integrations and a selection of non-bank integrations. See the Supported Integrations reference for the full list of integrations that have transaction data available.
TransactionCategory
Transaction category information from Akahu enrichment.
TransactionConversion
Details about a currency conversion for a transaction made in another currency.
TransactionGroups
Category groupings for different classification systems.
TransactionId
Transaction identifier (always prefixed with trans_).
TransactionMerchant
Akahu defines a merchant as the business who was party to this transaction. For example, “The Warehouse” is a merchant.
TransactionMeta
This is other metadata that we extract from the transaction, including the following fields (where possible).
TransferId
Transfer identifier (always prefixed with transfer_).
User
Represents the authenticated user’s profile information.
UserId
User identifier (always prefixed with user_).
UserToken
User access token obtained through OAuth.
VerificationSource
A single verification source result
VerifyNameItem
Verification details
VerifyNameRequest
Request to verify a name
VerifyNameResponse
Response from name verification

Enums§

Active
This attribute indicates the status of Akahu’s connection to this account.
AddressKind
Type of address
AkahuError
Common Akahu error types as per the documentation.
Attribute
The list of attributes indicates what abilities an account has.
BankAccountKind
What sort of account this is. Akahu provides specific bank account types, and falls back to more general types for other types of connection.
BankPrefix
Represents the specific Bank/Financial Institution based on the 2-digit prefix.
IdentityStatus
Status of an identity verification
MatchResult
Match result from verification
TransactionKind
What sort of transaction this is. Akahu tries to find a specific transaction type, falling back to “CREDIT” or “DEBIT” if nothing else is available.
VerificationSourceType
Type of verification source