Ledger Management
Open Ledger provides comprehensive APIs for managing entities (ledgers) and their financial transactions. This guide covers how to create, update, and delete entities, as well as how to work with transactions within those entities.
Entities
An “entity” in Open Ledger represents a financial ledger for a business entity. It contains all financial transactions and accounts for that entity.
Creating an Entity
To create a new entity, use the following endpoint:
Required Fields:
developerId
- The ID of the developer creating the entity
Optional Fields:
legalName
- Legal name of the entitytin
- Tax Identification NumberusState
- US state codeentityType
- Type of entity (LLC, CORPORATION, etc.)phoneNumber
- Contact phone numberexternalId
- Your own identifier for the entityclerkId
- Clerk ID (alternative to developerId)
Retrieving Entity Details
To get the details of a specific entity:
Updating an Entity
To update an existing entity:
Deleting an entity
To delete an entity:
Transactions
Transactions record financial activities within an entity. Each transaction represents a financial event using double-entry accounting principles with debit and credit accounts.
Adding Transactions
To add a new transaction:
Required Fields:
amount
- The transaction amountdebitAccountId
- ID of the account to debitcreditAccountId
- ID of the account to credit
Optional Fields:
description
- Description of the transactiondate
- Transaction date (defaults to current time)currency
- Currency code (defaults to USD)status
- Transaction status (PENDING or CLEARED)metadata
- Additional transaction data
Retrieving Transactions
To retrieve transactions for an entity:
Query Parameters:
entityId
- Required entity IDcursor
- Pagination cursorpageSize
- Number of transactions per page (default: 50)
Editing a Transaction
To edit an existing transaction:
Deleting a Transaction
To delete a transaction:
Approving Transactions
To approve transactions (change status from PENDING to POSTED):
Request Body Options:
- Single transaction ID as string:
"txn_123456"
- Array of transaction IDs:
["txn_123456", "txn_789012"]
- Array of transaction objects:
[{"id": "txn_123456"}]
- Single transaction object:
{"id": "txn_123456"}
Additional Transaction Endpoints
Get Transactions by Month
Search Transactions
Categorize a Transaction
Bank Connection
Open Ledger allows you to connect bank accounts to automatically import transactions:
Creating a Bank Link
Response:
Adding Bank Accounts
Code Example
Best Practices
- Use Double-Entry Accounting: Always specify both debit and credit accounts for transactions
- Regular Reconciliation: Regularly reconcile transactions with external sources
- Consistent Account Structure: Maintain a well-organized chart of accounts
- Transaction Documentation: Add detailed descriptions and metadata to transactions
- Handle Pagination: Use cursor-based pagination for large datasets
- Error Handling: Implement robust error handling for all API calls
- Secure API Keys: Keep your API keys secure and rotate them regularly
- Use Appropriate Status: Start with PENDING status and approve transactions when ready
Important Notes
- No Bulk Operations: The API currently does not support bulk create/update/delete operations for transactions
- Required Developer ID: All entities must be associated with a developer or clerk ID
- Double-Entry Required: All transactions must specify both debit and credit accounts
- Cursor Pagination: Use cursor-based pagination instead of offset-based for better performance