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

# ETL: Connecting to Xero

> Connect Xero accounting data to Integrate.io ETL. Set up OAuth authorization and build a data pipeline for reading Xero financial records.

Integrate.io ETL can access your Xero data. This article details creating the Xero connection and the process of building a data pipeline to read Xero data in Integrate.io ETL. There are also pre-built templates to read data from Xero. Please see [Create a package from a template](/etl/create-a-package-from-a-template) for instructions on using a template.

## To create a Xero connection in Integrate.io ETL

<Steps>
  <Step>
    Click the **Connections** icon (lightning bolt) on the top left menu.
  </Step>

  <Step>
    To create a connection, click **New connection**.

    <Frame>
      <img src="https://mintcdn.com/integrateio/V1Ns1A4dfxUcZVN3/images/connectivity-and-security/image-268.webp?fit=max&auto=format&n=V1Ns1A4dfxUcZVN3&q=85&s=ec5007cd3be4435f0301dd83a59d1a16" alt="New connection button in the Connections menu" width="1200" height="828" data-path="images/connectivity-and-security/image-268.webp" />
    </Frame>
  </Step>

  <Step>
    Select Xero.

    <Frame>
      <img src="https://mintcdn.com/integrateio/V1Ns1A4dfxUcZVN3/images/connectivity-and-security/image-269.webp?fit=max&auto=format&n=V1Ns1A4dfxUcZVN3&q=85&s=bbc05380a8d6a217506d4a785f069e42" alt="Selecting Xero from the connection type list" width="1200" height="828" data-path="images/connectivity-and-security/image-269.webp" />
    </Frame>
  </Step>

  <Step>
    Click **Authenticate.** (If required, sign in to Xero)
  </Step>

  <Step>
    Click **Connect** to authorize Integrate.io ETL access to your Xero account.
  </Step>

  <Step>
    In the new Xero connection window, name the connection and click **Create Xero connection.**
  </Step>
</Steps>

## To modify Xero connections in Integrate.io ETL

<Steps>
  <Step>
    Click the **Connections** icon (lightning bolt) on the top left menu.
  </Step>

  <Step>
    Click a connection to re-connect if your password has changed or the token has expired.
  </Step>

  <Step>
    To delete a Xero connection, click on the three vertical dots on the far right of the connection listing and select the Delete connection option.
  </Step>
</Steps>

## To build a data pipeline to read Xero account data in Integrate.io ETL

<Frame>
  <img src="https://mintcdn.com/integrateio/V1Ns1A4dfxUcZVN3/images/connectivity-and-security/image-270.webp?fit=max&auto=format&n=V1Ns1A4dfxUcZVN3&q=85&s=f57adb0f4e05f2cc93dc71a855491fa9" alt="Xero account data pipeline overview in the package designer" width="1200" height="828" data-path="images/connectivity-and-security/image-270.webp" />
</Frame>

## REST API Component: accounts

* **Authentication** - Click **Connection** and then select your Xero connection. If you haven't created your Xero connection yet, click **+ New** and follow the instructions found above.
  <Frame>
    <img src="https://mintcdn.com/integrateio/V1Ns1A4dfxUcZVN3/images/connectivity-and-security/image-271.webp?fit=max&auto=format&n=V1Ns1A4dfxUcZVN3&q=85&s=347a4f15eeb49ce1e1a6f55f25e0f2a5" alt="REST API component authentication with Xero connection selected" width="2042" height="820" data-path="images/connectivity-and-security/image-271.webp" />
  </Frame>
* **URL** - Enter the URL for the Accounts endpoint of the Xero API: **`https://api.xero.com/api.xro/2.0/Accounts`**. Make sure the method is set to **GET.** Click **Add** beneath **Headers** twice to add the following two headers: Accept: application/json, If-Modified-Since: `$last_updated_at`. Replace the variable `$last_updated_at` with a timestamp for the minimum age of the updated data.
  <Frame>
    <img src="https://mintcdn.com/integrateio/K1OxIkBgHF64pvnH/images/connectivity-and-security/image-272.webp?fit=max&auto=format&n=K1OxIkBgHF64pvnH&q=85&s=29e2a7b76d69d3c69ae8a0f3453ec368" alt="Xero Accounts API endpoint URL and custom headers configuration" width="2060" height="810" data-path="images/connectivity-and-security/image-272.webp" />
  </Frame>
* **Response** - Make sure the **JSON** response type is selected. Edit the **Base record JSON Path Expression** field like this: `$.Accounts[*]`.
  <Frame>
    <img src="https://mintcdn.com/integrateio/K1OxIkBgHF64pvnH/images/connectivity-and-security/image-273.webp?fit=max&auto=format&n=K1OxIkBgHF64pvnH&q=85&s=0f79a3f9599048a343d3a672e756a227" alt="JSON response type with base record JSONPath expression" width="1702" height="688" data-path="images/connectivity-and-security/image-273.webp" />
  </Frame>
* **Input fields** - Click **Select all** to move all the Available fields over to the Selected fields or pick and choose which fields you would like by clicking on the + icon next to the field name in the Available Fields column. Then click **Save**.
  <Frame>
    <img src="https://mintcdn.com/integrateio/K1OxIkBgHF64pvnH/images/connectivity-and-security/image-274.webp?fit=max&auto=format&n=K1OxIkBgHF64pvnH&q=85&s=7ffa503916eb416552a25ab16de4e5b3" alt="Input fields selection with available and selected fields" width="1077" height="831" data-path="images/connectivity-and-security/image-274.webp" />
  </Frame>

## Select Component: parse\_account\_fields

* Click **Autofill** to bring in all the fields from the source component. Convert the UpdatedDateUTC field into a datetime data type using these functions: **ToDate((long)REPLACE(REPLACE(UpdatedDateUTC,'\\/Date\\(',''),'\\+.\*','')).** Click **Save.**
  <Frame>
    <img src="https://mintcdn.com/integrateio/K1OxIkBgHF64pvnH/images/connectivity-and-security/image-275.webp?fit=max&auto=format&n=K1OxIkBgHF64pvnH&q=85&s=8ba725c28491572bf5a07f488c740281" alt="Select component converting UpdatedDateUTC to datetime" width="1072" height="912" data-path="images/connectivity-and-security/image-275.webp" />
  </Frame>

## Destination Component: xero\_accounts\_destination

* The template shows a Redshift destination component; however, if you'd prefer to use a different destination, delete the Redshift component and select a destination component of your choice.
  <Frame>
    <img src="https://mintcdn.com/integrateio/K1OxIkBgHF64pvnH/images/connectivity-and-security/image-276.webp?fit=max&auto=format&n=K1OxIkBgHF64pvnH&q=85&s=bf90b79c66f2b7427bb4727aa1a71f03" alt="Redshift destination component in the pipeline designer" width="737" height="828" data-path="images/connectivity-and-security/image-276.webp" />
  </Frame>
* **Choose target connection** - Select your target connection. If you haven't created your connection yet, click **+ New.**
  <Frame>
    <img src="https://mintcdn.com/integrateio/K1OxIkBgHF64pvnH/images/connectivity-and-security/image-277.webp?fit=max&auto=format&n=K1OxIkBgHF64pvnH&q=85&s=894ccf717e5900b22ad2cd0151094e62" alt="Target connection selection dropdown" width="2032" height="694" data-path="images/connectivity-and-security/image-277.webp" />
  </Frame>
* **Destination properties** - Fill in the values for target schema and table, select an operation type, pre or post-action SQL, and advanced options.
* **Schema mapping** - Click **Auto-fill** to bring in all of the fields. If you've selected a Merge operation type, click the **Key** box next to the merge key field(s). Click **Save.**
  <Frame>
    <img src="https://mintcdn.com/integrateio/K1OxIkBgHF64pvnH/images/connectivity-and-security/image-278.webp?fit=max&auto=format&n=K1OxIkBgHF64pvnH&q=85&s=4d417bd007a0b0fc6962c0d7911c4953" alt="Schema mapping with auto-filled fields and merge key selection" width="2184" height="1298" data-path="images/connectivity-and-security/image-278.webp" />
  </Frame>
