> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tesouro.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Push an invoice

> Learn how to synchronize a single invoice between Tesouro and your accounting system.

## Overview

This page aims to showcase how to synchronize a specific invoice, the possible issues during the synchronization, and how to troubleshoot them.

<Warning>
  Before pushing an invoice, you are required to have a [synchronized connection](/finops/guides/accounting/integration/index) between
  Tesouro and your accounting system.
</Warning>

## 1. Before pushing an invoice

The following requirements must be met before pushing an invoice to your accounting system:

* Either the organization setting [`accounting.ledger_account_ids.products`](/finops/reference/openapi/identity/patch-organizations-id-settings#request.body.accounting.ledger_account_ids.products) must be specified, or each product listed on an invoice (both catalog products and inline products) must have the `ledger_account_id` specified.
* The accounting system must include tax rates with the same numerical values as used in the invoice in Tesouro.
* If the invoice includes [special deductions or incentives](/finops/guides/accounts-receivable/special-deductions), the organization setting [`accounting.tax_ids.deductions`](/finops/reference/openapi/identity/patch-organizations-id-settings#request.body.accounting.tax_ids.deductions) must be specified.

## 2. Run the synchronization

The synchronization automatically happens every hour following the initial synchronization between Tesouro and the organization’s accounting system. This action maps all the related objects between Tesouro and the accounting system.

You can also trigger the data synchronization on demand by calling [`POST /accounting-connections/{connection_id}/sync`](/finops/reference/openapi/accounting-connections/post-accounting-connections-id-sync):

```sh lines theme={null}
curl -X POST 'https://api.sandbox.tesouro.com/v1/accounting-connections/fba2b...dfa/sync' \
     -H 'X-Finops-Version: 2025-06-23' \
     -H 'X-Organization-Id: ORGANIZATION_ID' \
     -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
```

The successful response confirms the synchronization was triggered. The processing time may vary according to the amount of data synchronized:

```json lines theme={null}
{
  "message": "Started connection data sync."
}
```

Tesouro will automatically push all invoices when they are moved from the `draft` to `issued` [status](/finops/guides/accounts-receivable/invoices/index).

## 3. Check for a specific invoice

The synchronization time may vary according to the size of the invoice. You can check the status of the synchronization by calling [`GET /accounting-synced-records?object_type=receivable&object_id={object_id}`](/finops/reference/openapi/accounting-synchronized-records/get-accounting-synced-records).

The query parameter `object_type` is **mandatory**. You can sort and filter the results by other fields. For the full list of available sort and filter parameters, see the [`GET /accounting-synced-records`](/finops/reference/openapi/accounting-synchronized-records/get-accounting-synced-records) endpoint:

```sh lines theme={null}
curl -X GET 'https://api.sandbox.tesouro.com/v1/accounting-synced-records?object_type=receivable&object_id=3fa85...fa6' \
     -H 'X-Finops-Version: 2025-06-23' \
     -H 'X-Organization-Id: ORGANIZATION_ID' \
     -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
```

The successful response returns the record of the synced document, as well as the `synced_record_id`:

```json expandable lines theme={null}
{
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "created_at": "2024-08-26T17:40:28.012Z",
      "updated_at": "2024-08-26T17:40:28.012Z",
      "errors": {},
      "last_pulled_at": "2024-08-26T17:40:28.012Z",
      "object_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "object_type": "product",
      "object_updated_at": "2024-08-26T17:40:28.012Z",
      "platform": "xero",
      "platform_object_id": "7ec6c435-8ed2-4a12-a2e2-2b86cfdc4407",
      "platform_updated_at": "2024-08-26T17:40:28.012Z",
      "provider": "provider_name",
      "provider_object_id": "e802714c-4218-4775-a569-3e6a10281a5f",
      "provider_updated_at": "2024-08-26T17:40:28.012Z",
      "sync_status": "pending"
    }
  ],
  "next_pagination_token": "eyJvcmRlciI6ImFzYyIsImxpbW...",
  "prev_pagination_token": null
}
```

## Troubleshooting

Failed syncs return the `errors` field, which contains the error status with details:

```json expandable lines theme={null}
{
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "created_at": "2024-08-26T17:40:28.012Z",
      "updated_at": "2024-08-26T17:40:28.012Z",
      "errors": {},
      "last_pulled_at": "2024-08-26T17:40:28.012Z",
      "object_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "object_type": "product",
      "object_updated_at": "2024-08-26T17:40:28.012Z",
      "platform": "xero",
      "platform_object_id": "7ec6c435-8ed2-4a12-a2e2-2b86cfdc4407",
      "platform_updated_at": "2024-08-26T17:40:28.012Z",
      "provider": "provider_name",
      "provider_object_id": "e802714c-4218-4775-a569-3e6a10281a5f",
      "provider_updated_at": "2024-08-26T17:40:28.012Z",
      "sync_status": "pending"
    }
  ],
  "next_pagination_token": "eyJvcmRlciI6ImFzYyIsImxpbW...",
  "prev_pagination_token": null
}
```

Here are some possible reasons for errors and the suggested approach:

<AccordionGroup>
  <Accordion title="Tax rate does not exist">
    Ensure that a tax rate with the exact numerical value exists in the accounting platform. Receivable line items include the `accounting_tax_rate_id` field, which allows overriding the default tax rate when pushing invoices to an accounting system. Valid tax rate IDs can be retrieved using the [`GET /accounting-tax-rates`](/finops/reference/openapi/accounting-tax-rates/get-accounting-tax-rates) endpoint.
  </Accordion>
</AccordionGroup>

You can re-try to push the invoice manually by calling [`POST /accounting-synced-records/{synced_record_id}/push`](/finops/reference/openapi/accounting-synchronized-records/post-accounting-synced-records-id-push). This action requires the `synced_record_id` of the related error entry.

If you continue to experience issues and need further assistance with the accounting integration, please [contact our Support Team](/finops/support/).
