Overview
A general ledger (GL) account is a component of an accounting system that is used to record and categorize a company’s financial transactions. Some examples of common ledger accounts are:- Expenses: office supplies, utilities, salaries, taxes, and so on,
- Income: sales and revenue, dividends, and so on,
- Assets: cash, inventory, and so on,
- Liabilities: accounts payable, debt, and so on.
ledger_account_id field of products and payable line items is used to assign ledger accounts to business objects. Additionally, the organization setting accounting.ledger_account_ids.payments specifies the ledger account for all payment records.
Tesouro supports two types of ledger accounts:
- External ledger accounts (
is_external = true): These are pulled from connected accounting systems and are read-only in Tesouro. They reflect the chart of accounts from your external accounting software. - Internal ledger accounts (
is_external = false): These are created and managed directly within Tesouro, giving you flexibility to define custom accounts for your business needs.
ledger_account_id pre-filled. However, when new products, payables, and payment records are created in Tesouro, the user must manually specify the ledger_account_id for those objects. This is required for Tesouro to be able to push those objects to the accounting system.
External ledger accounts
For external ledger accounts, the typical flow is as follows:- After connecting an organization to an accounting system, wait until the initial data pull is completed.
- Call
GET /ledger-accountsto get a list of an organization’s general ledgers pulled from the accounting system. - If an organization uses accounts payable:
- Get the line items of all payables and check if the line items have
ledger_account_id. - If any line item is missing a value for
ledger_account_id, prompt the user to assign the appropriate ledger account.
- Get the line items of all payables and check if the line items have
- If an organization uses accounts receivable:
- Get all products and check if they have
ledger_account_id. - If any product is missing a value for
ledger_account_id, prompt the user to assign the appropriate ledger account.
- Get all products and check if they have
- If an organization uses payment records:
- Prompt the user to specify a ledger account for all payment records and store the account ID in the organization setting
accounting.ledger_account_ids.payments.
- Prompt the user to specify a ledger account for all payment records and store the account ID in the organization setting
Internal ledger accounts
You can create internal ledger accounts directly in Tesouro using thePOST /ledger-accounts endpoint:
201 response returns the created ledger account:
All fields in the create request are optional. Internal ledger accounts are created with
is_external = false by default.Get ledger accounts
After connecting to an accounting system, Tesouro automatically retrieves a list of ledger accounts from there. Once the initial data synchronization has completed, you can callGET /ledger-accounts to get an organization’s ledger accounts that exist in the accounting system:
ledger_account_id field in products and payable line items.
GET /ledger-accounts endpoint can also be used to retrieve internal ledger accounts by setting the query parameter is_external = false (e.g., GET /ledger-accounts?is_external=false).
To get information about a specific ledger account, call GET /ledger-accounts/{ledger_account_id}.
Edit a ledger account
To edit an existing ledger account, callPATCH /ledger-accounts/{ledger_account_id}.
This operation is only available for cost centers where
is_external = false.Delete a ledger account
To delete a specific ledger account, callDELETE /ledger-accounts/{ledger_account_id}.
This operation is only available for cost centers where
is_external = false.Assign ledger accounts to products and payable line items
Before payables can be pushed to an accounting system, each line item in all payables must have theledger_account_id specified. Similarly, before Account Receivable invoices can be pushed to accounting, all products listed on invoices must have the ledger_account_id specified.
To specify an associated ledger account for a payable line item or a product, PATCH this object and provide the value for ledger_account_id. For example:
Assign a ledger account to payment records
Before payment records can be pushed to an accounting system, the organization must specify the ledger account for these records. To do this, store the account ID in the organization settingaccounting.ledger_account_ids.payments:
This setting can be changed at any time, but it will have no impact on payment records that have
already been pushed.