What are ledgers?
Ledgers are containers that organize and group related balances in your Blnk implementation. Think of a ledger as a financial book that holds multiple account balances. Each ledger represents a logical grouping of balances, such as all customer wallets, merchant accounts, or internal operational accounts. Ledgers help you:- Organize balances by business function, customer segment, or product type
- Isolate financial operations for different parts of your application
- Track and report on specific groups of balances
- Apply different rules or configurations to different balance groups
Ledger structure
The Ledger model in Blnk contains the following fields:Unique identifier for the ledger (auto-generated)
Human-readable name for the ledger
When the ledger was created
Custom metadata for storing additional information about the ledger
Example ledger object
Creating a ledger
You can create a ledger by sending a POST request to the/ledgers endpoint:
Response
Response
Organizing balances with ledgers
Once you have a ledger, you can create balances within it. Each balance must belong to exactly one ledger. This relationship helps you organize your financial structure.Common ledger patterns
Customer ledger
Group all customer wallet balances for easy tracking and reporting
Merchant ledger
Separate merchant settlement accounts from customer balances
Internal ledger
Track operational accounts like fees, escrow, or reserves
Currency ledger
Organize balances by currency for multi-currency operations
Example: Multi-ledger setup
Managing ledgers
Retrieve a ledger
List all ledgers
Update a ledger
You can update the name of an existing ledger:Filter ledgers
You can filter ledgers using query parameters:Ledgers cannot be deleted once created. This ensures data integrity and maintains a complete audit trail of your financial operations.
Best practices
Use descriptive names
Use descriptive names
Choose clear, descriptive names that indicate the purpose of the ledger. Avoid generic names like “Ledger 1” or “Main”.Good examples:
- “Customer USD Wallets”
- “Merchant Settlement Accounts”
- “Platform Fee Revenue”
Leverage metadata
Leverage metadata
Use the
meta_data field to store additional context about your ledgers. This can include:- Project or tenant identifiers
- Geographic regions
- Environment tags (production, staging)
- Business unit information
Plan your ledger structure
Plan your ledger structure
Think about how you’ll need to query and report on your data. Create ledgers that align with your business structure and reporting requirements.Consider organizing by:
- Customer type (retail, business, premium)
- Product or service line
- Currency or region
- Operational function (trading, settlement, fees)
Keep ledger count manageable
Keep ledger count manageable
While you can create many ledgers, keeping the number reasonable makes your system easier to understand and maintain. Aim for logical groupings rather than creating a ledger for every individual use case.
Next steps
Balances
Learn how to create and manage balances within ledgers
Transactions
Record financial movements between balances