Overview
The Transactions API provides access to your Fold Money transaction history. Data is fetched using the Unfold CLI tool and stored locally in a SQLite database for fast retrieval.Get Transactions
Retrieves transaction history from the local SQLite database
Behavior
- Returns up to 50 most recent transactions
- Automatically creates DB on first request if logged in
- Returns empty array if DB doesn’t exist or has no transactions
- Transactions are sorted by timestamp in descending order (newest first)
Example Request
Response
Returns an array of transaction objects:Unique identifier for the transaction
Transaction amount (positive for credits, negative for debits)
Account balance after this transaction
ISO 8601 formatted timestamp of the transaction
Transaction type (e.g., “debit”, “credit”)
Account identifier or name
Merchant name or transaction description
Example Response
Empty Response
When no transactions are available:Sync Transactions
This endpoint manually triggers a sync with Fold Money to fetch the latest transactions.
Synchronizes transaction data from Fold Money API to local database
Prerequisites
The sync process:- Reads authentication tokens from
unfold_config.yaml - Executes the Unfold CLI:
./unfold/unfold transactions --db --config ./unfold_config.yaml - Updates the local SQLite database at
./unfold/db.sqlite
Example Request
Response
Returns
"success" when sync completes successfullyError Responses
Not Logged In:Error message describing sync failure (500 status code)
Database Schema
Transactions are stored in SQLite at./unfold/db.sqlite:
Table: transactions
| Column | Type | Description |
|---|---|---|
| uuid | TEXT | Primary key, unique transaction ID |
| amount | REAL | Transaction amount |
| current_balance | REAL | Balance after transaction |
| timestamp | TEXT | ISO 8601 timestamp |
| type | TEXT | Transaction type |
| account | TEXT | Account identifier |
| merchant | TEXT | Merchant/description |
Query Details
The API executes this SQL query:Data Flow
Configuration
The API uses these constants:Ensure the Unfold binary has execute permissions:
chmod +x ./unfold/unfoldError Handling
| Scenario | Status | Response |
|---|---|---|
| DB doesn’t exist | 200 | [] (empty array) |
| Table doesn’t exist | 200 | [] (empty array) |
| DB read error | 200 | [] (empty array) |
| Sync not authenticated | 500 | {"detail": "Failed to sync..."} |
| Unfold binary error | 500 | {"detail": "execution error"} |
Best Practices
Periodic Syncing
Implement periodic syncing in your frontend:Error Handling
Always check authentication status before syncing:Next Steps
Portfolio Valuation
Calculate portfolio value with current NAV
Manage Holdings
Add or update mutual fund holdings