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

# Xero

> Gain financial visibility and empower your accounting team by keeping your financials up to date

## Overview

Give yourself confidence in the financial health of your business by integrating your Xero usage with Hightouch.
We automate your financial workflows and eliminate inconsistent data issues and manual data entry.

With this integration, you can deliver up-to-date data directly from your source of truth to allow your team the luxury to focus
on making financial decisions that benefit your business instead of wasting time finding, cleaning, and moving relevant data.

## Connect to Xero

**Authorize Xero with OAuth and create your destination.**

#### Add Xero as a destination in Hightouch

1. Log in to Hightouch or create a free Hightouch account
2. Click on **Destinations** in the left sidebar
3. Click on **Add destination** in the top right corner
4. Select **Xero** in the destination catalog and click **Continue** to proceed
5. Complete the authorization steps until you are redirected back to the Hightouch application
6. Give your destination a name and unique slug (for example, `Xero Production` and `Xero-production`)
7. Click **Finish** to create your Xero destination.

### Connect to your data source

Hightouch sits on top of your data warehouse and can read from Snowflake, Redshift, BigQuery, Databricks, Postgres, MySQL, and many other data sources. You can even fetch data from Google Sheets and Airtable. Hightouch can help activate your data wherever it resides.

We've written dedicated guides for each supported data source. Take your pick:

* Connect to [Airtable](https://docs.hightouch.com/sources/airtable)
* Connect to [Amazon Athena](https://docs.hightouch.com/sources/amazon-athena.md)
* Connect to [Amazon Redshift](https://docs.hightouch.com/sources/amazon-redshift.md)
* Connect to [Amazon S3](https://docs.hightouch.com/sources/s3.md)
* Connect to [ClickHouse](https://docs.hightouch.com/sources/clickhouse.md)
* Connect to [Databricks](https://docs.hightouch.com/sources/databricks.md)
* Connect to [Elasticsearch](https://docs.hightouch.com/sources/elasticsearch)
* Connect to [Firebolt](https://docs.hightouch.com/sources/firebolt)
* Connect to [Google BigQuery](https://docs.hightouch.com/sources/google-bigquery.md)
* Connect to [Google Sheets](https://docs.hightouch.com/sources/google-sheets.md)
* Connect to [Metabase](https://docs.hightouch.com/sources/metabase)
* Connect to [MongoDB](https://docs.hightouch.com/sources/mongodb)
* Connect to [MySQL](https://docs.hightouch.com/sources/mysql.md)
* Connect to [PostgreSQL](https://docs.hightouch.com/sources/postgresql.md)
* Connect to [Rockset](https://docs.hightouch.com/sources/rockset)
* Connect to [SFTP](https://docs.hightouch.com/sources/sftp.md)
* Connect to [Snowflake](https://docs.hightouch.com/sources/snowflake.md)
* Connect to [SQL Server](https://docs.hightouch.com/sources/sqlserver.md)
* Connect to [Trino](https://docs.hightouch.com/sources/trino.md)

> [!NOTE]
>
> If you're missing the credentials necessary to connect to your data source,
> try inviting your teammates to Hightouch. You can have unlimited collaborators
> in your workspace.

#### Connect to a sample database instead

Waiting for credentials to your data warehouse? No problem. You can connect to one of our [sample datasets](https://docs.hightouch.com/sources/sample-data.md) to get started right away. For the rest of this tutorial, we'll use the **B2B SaaS** sample source, which contains a `users` table. This sample source is available when you log in for the first time—no setup required.

Next, we'll write a SQL query to define which users should be synced to our Xero accounts resource. You can follow the same pattern to sync to other Xero resources.

### Create a model

In Hightouch, a model represents a query that filters or transforms the records in your data source. Models are used to determine exactly which records to sync between sources and destinations.

When you connect to a data warehouse, your models will probably be written in SQL. You can also import models from tools like dbt and Looker.

In this example, we'll keep it simple. Suppose you want to sync all your customers to Xero. To accomplish this, you'll want to create a model that looks like this:

```sql theme={null}
SELECT * FROM users;
```

1. Click on **Models** in the left sidebar.
2. Click on **Add model** in the top right corner.
3. Select **Demo Database** as your source and click **Continue** to proceed.
4. Select **SQL Editor** as your modeling method.
5. Paste the SQL query from above into the editor on the left side of the page.
6. Click **Preview** to execute the query.
7. Click **Continue** to proceed.
8. Give your model a name and unique slug (for example, "All Users" and `all-users`).
9. Select **ID** as the primary key for your model.
10. Click **Finish** to create your model.

We just created a model using a SQL query that retrieves all our current users. Next, we'll configure our sync to add these users to Xero.

### Create a sync

1. Click on **Syncs** in the left sidebar.
2. Click on **Add sync** in the top right corner.
3. Select **All Users** as your model and click **Continue** to proceed.
4. Select **Xero** as your destination and click **Continue** to proceed.

## Sync configuration

### Object selection

Hightouch supports syncing to the following Xero resources:

* **Accounts**.
* **Contacts**.
* **Payments**.
* **Invoices**.
* **Items**.

### Accounts

#### Account type selection

* Select the type of accounts you would like to sync to your destination. To sync dynamic types, toggle 'use column' and select a column from your model that contains supported enum values by Xero.

> [!NOTE]
>
> Selecting an account type from the drop-down menu allows Hightouch to provide
> you with the appropriate validations for each account type. These validations
> will not exist if you choose to sync dynamic types from your model and will
> require you to be familiar with what is required by Xero.

#### Sync modes

For **Bank** account type, our integration supports:

* **Insert** mode.

For all other account types, our integration supports:

* **Upsert**: Records that aren't found in Xero given the provided identifier will be inserted. Existing records will be updated.
* **Update**: Records that are found in Xero given the provided identifier will be updated.
* **Insert**: Records will be pushed to your destination.

#### Record matching

Records can be matched from your source to your Xero workspace by:

* **Account ID**
* **Name**

#### Field mapping

Hightouch allows you to sync columns from your source to the supported Xero fields.

#### Delete records

When the Hightouch sync engine recognizes that a record has been removed from your source, you can either:

In **Upsert** mode:

* Do nothing. An existing record in the destination would remain untouched.
* Delete the record in the destination. Only non-system accounts and accounts not used on transactions can be deleted.

### Contacts

#### Sync modes

This integration supports:

* **Upsert** mode: Records that aren't found in Xero given the provided identifier will be inserted. Existing records will be updated.

#### Record matching

Records can be matched from your source to your Xero workspace by:

* **Name**.

#### Field mapping

Hightouch allows you to sync columns from your source to the supported Xero fields.

### Payments

#### Sync modes

This integration supports:

* **Insert** mode: Records will be pushed to your destination.

#### Invoice record matching

Invoice records can be matched from your source to your Xero workspace by:

* **Invoice ID**
* **Invoice Number**
* **Credit Note ID**
* **Credit Note Number**

#### Account record matching

Account records can be matched from your source to your Xero workspace by:

**Account ID**
**Code**

#### Field mapping

Hightouch allows you to sync columns from your source to the supported Xero fields.

### Invoices

#### Invoice type selection

Select the type of invoices you would like to sync to your destination. To sync dynamic types, toggle 'use column' and select a column from your model that contains supported enum values by Xero.

#### Sync modes

This integration supports:

* **Upsert** mode: Records that aren't found in Xero given the provided identifier will be inserted. Existing records will be updated.
* **Insert** mode: Records that aren't found in Xero given the provided identifier will be inserted.

#### Record matching

In **Upsert** mode, records can be matched from your source to your Xero workspace by:

* **Invoice Number**

#### Field mapping

Hightouch allows you to sync columns from your source to the supported Xero fields.

#### Associations

Hightouch can perform a reference look-up for reference fields. Select an identifier to use to perform the look-up and use the respective contact to create the invoice object.

You can perform a look-up using:

* **Contact Number**
* **Email Address**
* **Name**

If the `Contact ID` exists in your model, you can skip the lookup step by selecting `Contact ID` from the drop-down menu.

### Items

#### Invoice type selection

Select the type of invoices you would like to sync to your destination. To sync dynamic types, toggle 'use column' and select a column from your model that contains supported enum values by Xero.

#### Sync modes

This integration supports:

* **Upsert** mode: Records that aren't found in Xero given the provided identifier will be inserted. Existing records will be updated.
* **Insert** mode: Records will be pushed to your destination.

#### Record matching

In **Upsert** mode, records can be matched from your source to your Xero workspace by:

* **Item Code**

#### Field mapping

Hightouch allows you to sync columns from your source to the supported Xero fields.

## Tips and troubleshooting

To see the exact API requests and responses from each sync run, use the [live debugger](https://docs.hightouch.com/syncs/debugger.md). To get notified by Slack, PagerDuty, SMS, or email when a sync fails, set up [sync alerts](https://docs.hightouch.com/syncs/alerting.md). If you run into an issue this page doesn't cover, [contact support](#pylon-chat).
