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.
- Account
Id - Account identifier (always prefixed with
acc_). - Account
Metadata - 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
- Address
Components - Structured address components
- Akahu
Client - The main Akahu API client.
- AppSecret
- Application secret for app-scoped endpoints.
- AppToken
- Application ID token for authenticating your app with Akahu.
- Auth
Code - OAuth authorization code (short-lived, valid for ~60 seconds).
- Authorization
Id - Authorization identifier (always prefixed with
auth_). - Balance
Details - The account balance.
- Bank
Account Number - A validated New Zealand bank account number.
- Branch
Info - Bank branch information
- Category
Id - Category identifier (always prefixed with
cat_). - Client
Secret - OAuth client secret used during the token exchange flow.
- Connection
Id - Connection identifier (always prefixed with
conn_). - Cursor
- Pagination cursor token.
- Cursor
Object - Cursor for paginating through transaction results.
- Enriched
Transaction Data - This is data added by the Akahu enrichment engine. You must have additional permissions to view this data.
- Error
Response - Standard error response structure from Akahu API
- Identity
- Identity item containing account holder information
- Identity
Account - Account information from identity verification
- Identity
Profile - OAuth profile information
- Identity
Source - Information about the institution connection
- Interest
Details - Interest rate information for a loan.
- Invalid
Bank Account Error - Error when a bank account number is invalid
- Invalid
Email Error - Error when an email address is invalid
- Invalid
IdError - Error when an ID doesn’t have the expected prefix
- Item
Response - Standard API response wrapper for a single item.
- List
Response - Standard API response wrapper for a list of items.
- Loan
Details - Detailed information related to a loan account.
- Merchant
Id - Merchant identifier (always prefixed with
_merchant). - Name
Verification - Boolean flags for name component verification
- Paginated
Response - Standard API response wrapper for paginated items.
- Party
- Party information from enduring access
- Payment
Details - Details for making a payment to an account that is not a bank account.
- Payment
Id - Payment identifier.
- Pending
Transaction - A pending transaction that has not yet been settled.
- Personal
Finance Group - Personal finance category group.
- Redirect
Uri - OAuth redirect URI used during the authorization flow.
- Refresh
Details - 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.
- Repayment
Details - 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.
- Transaction
Category - Transaction category information from Akahu enrichment.
- Transaction
Conversion - Details about a currency conversion for a transaction made in another currency.
- Transaction
Groups - Category groupings for different classification systems.
- Transaction
Id - Transaction identifier (always prefixed with
trans_). - Transaction
Merchant - Akahu defines a merchant as the business who was party to this transaction. For example, “The Warehouse” is a merchant.
- Transaction
Meta - This is other metadata that we extract from the transaction, including the following fields (where possible).
- Transfer
Id - Transfer identifier (always prefixed with
transfer_). - User
- Represents the authenticated user’s profile information.
- UserId
- User identifier (always prefixed with
user_). - User
Token - User access token obtained through OAuth.
- Verification
Source - A single verification source result
- Verify
Name Item - Verification details
- Verify
Name Request - Request to verify a name
- Verify
Name Response - Response from name verification
Enums§
- Active
- This attribute indicates the status of Akahu’s connection to this account.
- Address
Kind - Type of address
- Akahu
Error - Common Akahu error types as per the documentation.
- Attribute
- The list of attributes indicates what abilities an account has.
- Bank
Account Kind - What sort of account this is. Akahu provides specific bank account types, and falls back to more general types for other types of connection.
- Bank
Prefix - Represents the specific Bank/Financial Institution based on the 2-digit prefix.
- Identity
Status - Status of an identity verification
- Match
Result - Match result from verification
- Transaction
Kind - 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.
- Verification
Source Type - Type of verification source