Overview
Many businesses use accounting software to prepare financial data for tax authorities. Tesouro lets you connect your users’ data to their accounting software — pull financial data into your interface and push data back when they need to do post-accounting work outside your app.Supported accounting systems
Each organization can connect to one of the following accounting systems:- QuickBooks Online
- Xero
Requirements and considerations
- Tesouro partners supporting accounting integration must create developer accounts in each accounting platform they support.
- Each organization must have an account with their accounting system (Xero, QuickBooks) before creating an accounting connection via the Tesouro API.
Set up the integration
See Set up accounting integration.How the integration works
First, establish a connection to the organization’s accounting software and have an organization user authorize it. Once connected, Tesouro automatically syncs the organization’s financial data with their accounting software. After the initial sync, Tesouro syncs both systems every hour.Tesouro doesn’t push older invoices or bills during the initial sync. Only invoices and bills
eligible for pushing after the sync are pushed to the accounting software.
What data is synchronized
Tesouro supports two actions for synchronized data:Pull for matching
Pull for matching
Pulls external data into Tesouro for matching with existing records. No new records are created — the pulled data is only matched against what already exists.
Pull for creation
Pull for creation
Pulls external data and creates new entries in Tesouro for any unmatched records. If the pulled data doesn’t match an existing record, Tesouro creates one automatically.
Organizations can also pull records from the accounting system on demand by calling
POST /accounting-connections/{connection_id}/sync.
How data is synchronized
Pulling
Pulling
Pulling
This section describes how data is pulled from an accounting system.Ledger accounts
Ledger accounts are pulled only for mapping to products. Tesouro doesn’t create any new items during this process.To access the ledger accounts pulled from the accounting system, useGET /ledger-accounts.Counterparts
Counterparts from the accounting system are matched with existing counterparts in Tesouro, but Tesouro doesn’t create new counterparts if there’s no match.Counterparts are matched based on their names and each part of the billing address (country, city, street name, and so on). All counterpart types - both organizations and individuals - are pulled as organizations.If there’s no match, organizations can manually create counterparts in Tesouro to match their accounting system.Products
All products are pulled from the accounting system on the first connection. Data is pulled and IDs are matched by name. If a product doesn’t exist in Tesouro, Tesouro creates it and links it to the corresponding product in your accounting system.When a new product is created in the accounting system, Tesouro checks for a match. If it doesn’t find one, Tesouro pulls the product’s data and creates it internally.Limitations
- Products with a negative price or no price aren’t pulled.
- A product isn’t pulled from accounting if two or more products with the same name exist in Tesouro.
GET /accounting-synced-records?object_type=product.Tax rates
Tax rates are pulled only for mapping. Tesouro doesn’t create new items during this process, so unmatched tax rates are ignored.To access the tax rates pulled from the accounting system, useGET /accounting-tax-rates.Handling multiple matchesIf a product’s name matches multiple products on either system, Tesouro doesn’t attempt to match any of them. The error is returned in your
sync_object.Accounts payable: invoices (bills)
Payables are pulled only for access purposes, they are neither matched nor created.To get the list of payables (bills) from the accounting system, useGET /accounting/payables.Accounts receivable: invoices
Invoices are pulled only for access purposes, they are neither matched nor created.To get the list of invoices from the accounting system, useGET /accounting/receivables.Pushing
Pushing
Pushing
This section describes how data is pushed to an accounting system.Ledger accounts
Ledger accounts aren’t pushed to the accounting system.Accounts payable: invoices (bills)
Only payables in theissued and canceled statuses are pushed. Before pushing, Tesouro validates that bills have tax_rate_ref_id, ledger_account_id, and line_items references. Bills can’t be issued without these fields.Accounts receivable: invoices
Tesouro doesn’t push older invoices during the initial sync. After that, invoices are only pushed to the organization’s accounting system when they move to theissued status.The receivable line items include the accounting_tax_rate_id field, which allows overriding the default tax rate when pushing invoices to the accounting system. Valid tax rate IDs can be retrieved using the GET /accounting-tax-rates endpoint.Accounts receivable: credit notes
Credit notes are pushed without a document number. Users can backfill credit note numbers manually in the accounting system.Pushed credit notes aren’t associated with the corresponding invoices in the accounting system, so invoices there won’t be automatically canceled when a credit note is pushed.Payment records
Only payment records associated with accounts receivable invoices are pushed to the accounting system. Payment records for payables (bills) aren’t pushed.Before a payment record can be pushed, the organization must specify the ledger account to attach it to. Use the organization settingaccounting.ledger_account_ids.payments to specify the target ledger account. For more information, see Assign a ledger account to payment records.Counterparts
Tesouro pushes counterparts into the accounting system when:- A new counterpart is created in Tesouro.
- An invoice issued to that counterpart is pushed into the accounting system.
is_customer and is_vendor set to true, it’s pushed twice: we create a customer in the accounting system and also create a vendor with the same details but with the _VENDOR suffix in the name.Once counterparts are matched, there is no regular check for data changes in either system.GET /accounting-synced-records/{synced_record_id}. For more information, see Check synchronization logs.