Check for an active accounting connection
Before configuring a new accounting connection for an organization, make sure this organization has no other existing accounting connections that are active at the moment. For this purpose, callGET /accounting-connections with the X-Organization-Id header containing the organization ID:
200 OK response with an empty data array:
Trigger accounting synchronization
By default, Tesouro automatically synchronizes the organization’s data in our database with the data in the organization’s accounting system every hour. However, organizations can also trigger an instant synchronization when needed. To do this, callPOST /accounting-connections/{connection_id}/sync:
202 Accepted response is returned if the request is successful.
Disconnect an accounting system
To disconnect an already established accounting connection, callPOST /accounting-connections/{id}/disconnect:
200 OK response contains "status": "disconnected":
Check synchronization logs
You can obtain an overview of all the synchronization events between Tesouro and the accounting system in a list. When the synchronization is successful, the status and IDs of records from both systems will be returned. If not, an error status with details will be returned instead. To get a list with all the sync records, callGET /accounting-synced-records. Filtering the results by the object_type is mandatory. For example, GET /accounting-synced-records?object_type=bill will get all the sync records for bills (payables).
object_id query parameter to the request, for example:
For the full list of available sort and filter parameters, see the
GET /accounting-synced-records
endpoint.sync_status and errors fields, representing the synchronization status and information about any errors, respectively.
GET request to the /accounting-synced-records/{synced_record_id} endpoint.
List documents in the accounting system
You can list all invoices and payables (bills) that exist in the organization’s connected accounting system without the need to pull those documents into Tesouro, so you can implement custom document comparison and synchronization logic:GET /accounting/receivables- to list all invoicesGET /accounting/receivables/{invoice_id}- to retrieve a specific invoiceGET /accounting/payables- to list all payables (bills)GET /accounting/payables/{payable_id}- to retrieve a specific payable (bill)
Accounting tax rates
Retrieve accounting tax rates
When pushing an invoice to an accounting system, FinOps Hub tries to map the applicable tax rates used in the invoice to the tax rates available in the organization’s accounting system. Organizations can retrieve the available tax rates from the accounting system to ensure that they match thetax_rate_value field in the invoice line items. To do this, call GET /accounting-tax-rates:
Internal accounting tax rates
In addition to tax rates retrieved from your connected accounting system, Tesouro allows you to create and manage custom tax rates internally. Custom tax rates created in Tesouro have theis_external field set as false.
Create an internal tax rate
If your organization needs a tax rate that does not exist in the connected accounting system, you can create a custom tax rate callingPOST /accounting-tax-rates:
201 response returns the newly created tax rate:
Custom tax rates created in Tesouro (
is_external = false) can be used in invoices but may need
to be manually created in your accounting system if they do not already exist there.Retrieve internal tax rates
To get all available internal tax rates for an organization, callGET /accounting-tax-rates?is_external=false. To get details about a specific tax rate, call GET /accounting-tax-rates/{tax_rate_id}.
Edit an internal tax rate
You can update the details of an existing tax rate usingPATCH /accounting-tax-rates/{tax_rate_id}:
Delete an internal tax rate
To delete a tax rate, callDELETE /accounting-tax-rates/{tax_rate_id}.
Retry pushing data
You can manually retry a failed sync to the accounting system in cases where errors occur during the attempt by callingPOST /accounting-synced-records/{synced_record_id}/push. The synced_record_id of the failed sync can be obtained in the synchronization log: