/api/plaid.
Authentication
Plaid requires the following environment variables:PLAID_CLIENT_ID- Your Plaid client IDPLAID_SECRET- Your Plaid secret keyPLAID_ENV- Environment:sandbox,development, orproduction
Link Flow
Create Link Token
Create a Link token to initialize the Plaid Link frontend component.Unique identifier for your user. Used to associate Plaid accounts with your users.
Token used to initialize Plaid Link on the frontend. Valid for 4 hours.
Exchange Public Token
Exchange a public token (received from Plaid Link) for an access token.Public token received from Plaid Link after user completes authentication
User identifier to associate the access token with
Whether the token exchange was successful. The access token is stored server-side.
In production, access tokens should be encrypted and stored securely in a database. The current implementation uses in-memory storage for demonstration.
Account Data
Get Accounts
Retrieve all linked accounts for a user with enhanced financial profile data.Checking and savings accounts
Plaid account identifier
Account type:
depositoryAccount subtype:
checking, savings, etc.Account name from institution
Current balance in dollars
Available balance (may differ from current if holds exist)
Credit card accounts
Credit utilization ratio (balance / limit)
Annual percentage rate
Minimum payment due
Student loans, mortgages, and other loans
Original loan principal
Annual interest rate percentage
Monthly payment amount
Investment and brokerage accounts
Individual securities held in the account
Asset allocation breakdown by category
Analyzed income profile from transaction history
Estimated monthly income
Payment frequency:
weekly, biweekly, monthly, or irregularIncome stability score (0-1, higher is more stable)
Analyzed spending profile from transaction history
Monthly spending breakdown by category
Spending volatility coefficient (0-1)
Estimated monthly fixed/recurring expenses
Estimated monthly variable expenses
Calculated net worth: (liquid + investments) - (credit debt + loan debt)
Get Financial Profile
Retrieve a financial profile formatted specifically for Monte Carlo simulation.Total liquid assets (checking + savings)
Total credit card debt
Total loan debt (student loans, mortgages, etc.)
Total monthly loan payments
Estimated monthly income
Average monthly spending
Estimated monthly fixed/recurring bills
Spending breakdown by category for detailed analysis
Spending volatility coefficient used in simulation
Aggregated investment allocation across all investment accounts
Check Link Status
Check if a user has linked accounts.Whether the user has successfully linked a bank account
Data Sources
Plaid retrieves data from the following sources:- Accounts - Real-time balance and account details
- Transactions - Last 90 days of transaction history
- Liabilities - Credit card, student loan, and mortgage details (optional product)
- Investments - Holdings and securities data (optional product)
Income & Spending Analysis
The API automatically analyzes transaction data to extract:Income Detection
- Identifies recurring salary deposits
- Detects payment frequency (weekly, biweekly, monthly)
- Calculates income stability score
- Estimates monthly income
Spending Analysis
- Categorizes all expenses
- Separates fixed vs. variable expenses
- Calculates spending volatility
- Identifies recurring bills
Error Handling
Security Notes
Plaid Environments
- Sandbox - Testing with synthetic data (no real credentials)
- Development - Testing with real credentials (free for development)
- Production - Live environment (requires Plaid approval)
PLAID_ENV environment variable.