Path Parameters
The unique identifier of the balance to query.
Query Parameters
The point in time to retrieve the balance state, in ISO 8601 format.If not provided, returns the current balance state.Format:
YYYY-MM-DDTHH:MM:SSZ (e.g., 2024-01-15T15:04:05Z)Example: ?timestamp=2024-01-01T00:00:00ZCalculate balance from all source transactions instead of using snapshots.Options:
false(default): Use balance snapshots for efficient retrievaltrue: Calculate from all transactions since inception (slower but always accurate)
?from_source=trueResponse
The balance state at the specified time.
The ISO 8601 timestamp for which the balance was retrieved.
Indicates whether the balance was calculated from source transactions or snapshots.
Examples
Response Example
How It Works
Snapshot-Based Retrieval (Default)
By default, Blnk uses balance snapshots for efficient historical queries:- Daily Snapshots: Blnk creates periodic snapshots of balance states
- Nearest Snapshot: Finds the closest snapshot before the requested time
- Transaction Delta: Applies transactions between snapshot and target time
- Fast Results: Optimized for quick retrieval without processing all historical transactions
Source-Based Calculation
Whenfrom_source=true, Blnk calculates the balance from scratch:
- All Transactions: Retrieves all transactions affecting the balance
- Time Filter: Only includes transactions before the target timestamp
- Full Calculation: Sums all debits and credits from the beginning
- Guaranteed Accuracy: Always reflects the true state, useful for verification
Use Cases
Daily Reconciliation
Check end-of-day balances for reconciliation:Month-End Reporting
Generate month-end balance reports:Audit Trail
Verify historical balance states for compliance:Dispute Resolution
Retrieve balance state at the time of a disputed transaction:Time-Series Analysis
Generate balance trends over time:Balance Snapshots
To optimize historical queries, Blnk provides a snapshot mechanism:Creating Snapshots
Use the Create Balance Snapshots endpoint to generate snapshots in batches:When to Create Snapshots
- Daily: Run at end of day for all balances
- On-Demand: Before critical reporting periods
- Scheduled: Via cron jobs or scheduled tasks
Snapshot Benefits
- Faster historical queries
- Reduced database load
- Efficient time-travel queries
- Point-in-time recovery
Performance Considerations
Snapshot Method (Recommended):- Fast response times (milliseconds)
- Efficient for frequent queries
- Requires periodic snapshot creation
- Slower for long balance histories
- Guaranteed accuracy
- Use for verification or when snapshots aren’t available
- Good for recent timestamps or new balances
Error Responses
Common Errors:400 Bad Request: Invalid timestamp format or missing balance ID404 Not Found: Balance does not exist400 Bad Request: No balance data found for the specified time (balance didn’t exist yet)