Xero

This connector provides SQL access to your Xero backend.

Before you begin

Before using the Xero connector, do the following tasks:

  • In your Google Cloud project:
    • Ensure that network connectivity is set up. For information about network patterns, seeNetwork connectivity.
    • Grant theroles/connectors.admin IAM role to the user configuring the connector.
    • Grant the following IAM roles to the service account that you want to use for the connector:
      • roles/secretmanager.viewer
      • roles/secretmanager.secretAccessor

      A service account is a special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs. If you don't have a service account, you must create a service account. The connector and the service account must belong to the same project. For more information, seeCreating a service account.

    • Enable the following services:
      • secretmanager.googleapis.com (Secret Manager API)
      • connectors.googleapis.com (Connectors API)

      To understand how to enable services, seeEnabling services.

    If these services or permissions have not been enabled for your project previously, you are prompted to enable them when configuring the connector.

Xero configuration

The following tasks are required to configure Xero:

Set up a Xero account and Xero demo company

  1. Go toXero account to signup for a free Xero account.
  2. Go toXero Demo Company to enable the Xero demo company.

Generate OAuth2.0 client authentication details

  1. Login to theXero developer account.
  2. ClickSign Up and follow the prompts. If you already have an account, log in with your credentials.
  3. You will be directed to the Xero developer dashboard after logging in.

  4. Go to theXero developer portal fromMy Apps section in the Developer dashboard.
  5. ClickNew App orCreate a new app to create a new app.
  6. Enter the required details for your app, such as the app name, description, company URL, privacy policy URL, terms of use URL, and callback URL.
  7. Make sure to select the appropriate app type and permissions required for your integration with Xero's demo company.
  8. After you create your app, you will get the OAuth credentials, including a client ID and client secret.

  9. Store the client ID and client secret in a secured location for future use.
  10. When you create your integration, select the necessary scopes carefully for each schema to ensure that your application has the appropriate permissions to access and utilize the required utilities.

    For information about authentication and retrieving client ID and client secret, seeRetrieve client ID and client secret.

Set up schema details

You can select the schema based on the module. The available schemas are ACCOUNTING, ASSETS, PAYROLLAUS, FILES, and PROJECTS. As we have five different modules, you have to create different connections for each module.

For information about scopes that you can specify when you create a connection, seeScopes.

Set up authorization details

For information about setting up authorization URL, see Set up authorization URL.

Configure the connector

A connection is specific to a data source. Itmeans that if you have many data sources, you must create a separate connectionfor each data source. To create a connection, do the following:

  1. In theCloud console, go to theIntegration Connectors > Connections page and then select or create a Google Cloud project.

    Go to the Connections page

  2. Click+ Create new to open theCreate Connection page.
  3. In theLocation section, choose the location for the connection.
    1. Region: Select a location from the drop-down list.

      Supported regions for connectors include:

      For the list of all the supported regions, seeLocations.

    2. ClickNext.
  4. In theConnection Details section, complete the following:
    1. Connector: SelectXero from the drop down list of available Connectors.
    2. Connector version: Select the Connector version from the drop down list of available versions.
    3. In theConnection Name field, enter a name for the Connection instance.

      Connection names must meet the following criteria:

      • Connection names can use letters, numbers, or hyphens.
      • Letters must be lower-case.
      • Connection names must begin with a letter and end with a letter or number.
      • Connection names cannot exceed 49 characters.
    4. Optionally, enter aDescription for the connection instance.
    5. Optionally, enableCloud logging, and then select a log level. By default, the log level is set toError.
    6. Service Account: Select a service account that has therequired roles.
    7. Optionally, configure theConnection node settings:

      • Minimum number of nodes: Enter the minimum number of connection nodes.
      • Maximum number of nodes: Enter the maximum number of connection nodes.

      A node is a unit (or replica) of a connection that processes transactions. More nodes are required to process more transactions for a connection and conversely, fewer nodes are required to process fewer transactions. To understand how the nodes affect your connector pricing, see Pricing for connection nodes. If you don't enter any values, by default the minimum nodes are set to 2 (for better availability) and the maximum nodes are set to 50.

    8. Note: You can customize the connection node values only if you are a Pay-as-you-go customer.
    9. Schema: The Xero API you want to access as a database schema.
    10. Tenant: Sets the Xero organization to connect to. Can be a name or tenant ID.
    11. Verbosity Level: Verbosity level for connection, varies from 1-5. Higher verbosity level will log all the communication details (request,response & ssl certificates).
    12. Optionally, click+ Add label to add a label to the Connection in the form of a key/value pair.
    13. ClickNext.
  5. In theAuthentication section, enter the authentication details.
    1. Select anAuthentication type and enter the relevant details.

      The following authentication types are supported by the Xero connection:

      • OAuth 2.0 Client Credentials
      • OAuth 2.0 Auth Code Grant
    2. To understand how to configure these authentication types, seeConfigure authentication.

    3. ClickNext.
  6. Review: Review your connection and authentication details.
  7. ClickCreate.

Configure authentication

Enter the details based on the authentication you want to use.

  • OAuth 2.0 Client Credentials
    • Client ID: The client id provided by connector for the app you created.
    • Client Secret: Secret Manager Secret containing the client secret for the connected app you created.
  • OAuth 2.0 Auth Code Grant
    • Access token: The access token used for authenticating requests with auth-code-flow-based connections.
    • Client ID: The client ID used for requesting access tokens.
    • Client secret: The client secret used for requesting access tokens.

Connection configuration

This section lists the sample values for the various fields that you configure when creating the Xero connection.

Accounting server connection type

Field nameDetails
Regionus-central1
ConnectorXero
Connector version1
Connection Namegoogle-cloud-xero-accounting-connection
Service AccountSERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com
SchemaACCOUNTING
Verbosity Level5
Minimum number of nodes2
Maximum number of nodes50
AuthenticationOAuth 2.0 - Authorization code
Client IdCLIENT_ID
Scopesoffline_access openid profile email accounting.transactions, accounting.reports.read, accounting.attachments, accounting.journals.read, accounting.settings, accounting.contacts, accounting.budgets.read
Client secretCLIENT_SECRET
Secret Version1
Authorization URLhttps://login.xero.com/identity/connect/authorize

Assets server connection type

Field nameDetails
Regionus-central1
ConnectorXero
Connector version1
Connection Namegoogle-cloud-xero-assets-connection
Service AccountSERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com
SchemaASSETS
Verbosity Level5
Minimum number of nodes2
Maximum number of nodes50
AuthenticationOAuth 2.0 - Authorization code
Client IdCLIENT_ID
Scopesassets.read, assets
Client secretCLIENT_SECRET
Secret Version1
Authorization URLhttps://login.xero.com/identity/connect/authorize

Files server connection type

Field nameDetails
Regionus-central1
ConnectorXero
Connector version1
Connection Namegoogle-cloud-xero-files-connection
Service AccountSERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com
SchemaFILES
Verbosity Level5
Minimum number of nodes2
Maximum number of nodes50
AuthenticationOAuth 2.0 - Authorization code
Client IdCLIENT_ID
Scopesfiles, files.read
Client secretCLIENT_SECRET
Secret Version1
Authorization URLhttps://login.xero.com/identity/connect/authorize

Payrollaus server connection type

Field nameDetails
Regionus-central1
ConnectorXero
Connector version1
Connection Namegoogle-cloud-xero-payroll-connection
Service AccountSERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com
SchemaPAYROLLAUS
Verbosity Level5
Minimum number of nodes2
Maximum number of nodes50
AuthenticationOAuth 2.0 - Authorization code
Client IdCLIENT_ID
Scopespayroll.employees, payroll.payruns, payroll.payslip, payroll.timesheets, payroll.settings
Client secretCLIENT_SECRET
Secret Version1
Authorization URLhttps://login.xero.com/identity/connect/authorize

Projects server connection type

Field nameDetails
Regionus-central1
ConnectorXero
Connector version1
Connection Namegoogle-cloud-xero-projects-connection
Service AccountSERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com
SchemaPROJECTS
Verbosity Level5
Minimum number of nodes2
Maximum number of nodes50
AuthenticationOAuth 2.0 - Authorization code
Client IdCLIENT_ID
Scopesprojects, projects.read
Client secretCLIENT_SECRET
Secret Version1
Authorization URLhttps://login.xero.com/identity/connect/authorize

Entities, operations, and actions

All the Integration Connectors provide a layer of abstraction for the objects ofthe connected application. You can access an application's objects only through this abstraction. The abstraction is exposed to you as entities, operations, and actions.

Note: You can view the entities, operations, and actions of a connector in theConnectors task.
  • Entity:An entity can be thought of as an object, or a collection of properties, in theconnected application or service. The definition of an entity differs from a connector to a connector. For example, in a database connector, tables are the entities, in a file server connector, folders are the entities, and in a messaging system connector, queues are the entities.

    However, it is possible that a connector doesn't support or have any entities, in which case theEntities list will be empty.

  • Operation:An operation is the activity that you can perform on an entity. You can performany of the following operations on an entity:

    Selecting an entity from the available list, generates a list ofoperations available for the entity. For a detailed description of the operations, see the Connectors task'sentity operations. However, if a connector doesn't support any of the entity operations, such unsupported operations aren't listed in theOperations list.

  • Action:An action is a first class function that is made available to the integrationthrough the connector interface. An action lets you make changes to an entity or entities, and vary from connector to connector. Normally, an action will have some input parameters, and an output parameter. However, it is possible that a connector doesn't support any action, in which case theActions list will be empty.
Note:All entities and actions will have a schema associated with them. For example, an action schema will have the parameter details such as; the parameternames, and its corresponding data type. The schema (metadata) for entities and actions is fetched by the connection atruntime from your backend. If there are any updates to the schema, such updates won't be automatically reflected in your existing connections; you must manually refresh the schema. To refreshthe schema for a connection, open theConnection details page of the connection, and then clickRefresh connection schema.

Use the Xero connection in an integration

System limitations

The Xero connector can process 5 transaction per second, pernode, andthrottles any transactions beyond this limit. However, the number transactions that the Xero connector can process also depends on the constraints imposed by the Xero instance. For more information, seeXero API rate limits. By default, Integration Connectors allocates 2 nodes (for better availability) for a connection.

For information on the limits applicable to Integration Connectors, seeLimits.

Note: The number ofIntegration Connectors nodes will autoscale dynamically based on your usage. However, if you want to reserve capacity for large volumes without waiting for autoscaling, you can adjust the minimum node value for a connection. More nodes are required to process more transactions for a connection. Conversely, fewer nodes are required if a connection processes fewer transactions. To configure the node values, do the following:
  • If you are a pay-as-you-go customer, configure the minimum and maximum node value in the edit connection page.
  • If you are a subscription based customer,contact support.

The maximum transactions that a node can handle depends on various factors. So, before adjusting the minimum nodes for better throughput, it is recommended you check if your backend systems are set up optimally to handle the required traffic.

Actions

This section lists some of the actions supported by the connector. To understand how to configure the actions, seeAction examples.

Note: The results of all the actions will be available as a JSON response in theConnectors task'sconnectorOutputPayload response parameter after you run your integration.

DownloadAttachment action

This action downloads an attachment.

Input parameters of the DownloadAttachment action

Parameter nameData typeRequiredDescription
FilenameStringNoName of the attachment to download.
TableStringNoName of the table from where we have to download the attachment.
ObjectIdStringNoObjectId of the attachment.

Output parameters of the DownloadAttachment action

This action returns the status 200 (OK) if the download is successful.

To understand how to configure theDownloadAttachment action, seeAction examples.

UploadAttachment action

This action lets you upload an attachment.

Input parameters of the UploadAttachment action

Parameter nameData typeRequiredDescription
FilenameStringNoName of the attachment to upload.
ObjectIdStringNoObjectId of the attachment.
ContentTypeStringNoContent type of the attachment.
TableStringNoName of the table in which the attachment should be uploaded.
ContentStringNoContent of the attachment

Output parameters of the UploadAttachment action

This action returns the status 200 (OK) if the object upload is successful.

To understand how to configure theUploadAttachment action, seeAction examples.

ListAttachment Action

This action lets you list all the attachments of a table.

Input parameters of the ListAttachment action

Parameter nameData typeRequiredDescription
ObjectIdStringNoObject ID of the attachment.
TableStringNoName of the table from which the attachments have to be listed.

Output parameters of the ListAttachment action

This action returns the status 200 (OK) if the deletion is successful.

To understand how to configure theListAttachment action,seeAction examples.

SendInvoiceMail action

This action let you send emails to an invoicer.

Input parameters of the SendInvoiceMail action

Parameter nameData typeRequiredDescription
InvoiceIdStringNoId of the invoice for which the mail should be sent.

Output parameters of the SendInvoiceMail action

This action returns the status 200 (OK) if the move operation is successful.

To understand how to configure theSendInvoiceMail action,seeAction examples.

UploadFile action

This action lets you upload a file.

Input parameters of the UploadFile action

Parameter nameData typeRequiredDescription
NameStringNoName of the file to be uploaded.
ContentStringNoFile content to be uploaded.

Output parameters of the UploadFile action

This action returns the status 200 (OK) if the object upload is successful.

To understand how to configure theUploadFile action,seeAction examples.

Action examples

This section describes how to perform some of the actions in this connector.

Example - Download an attachment

This example downloads an attachment.

  1. In theConfigure connector task dialog, clickActions.
  2. Select theDownloadAttachment action, and then clickDone.
  3. In theTask Input section of theConnectors task, clickconnectorInputPayload and then enter a value similar to the following in theDefault Value field:
    {"Filename":"Xero_Test.txt","Table":"Contacts","ObjectId":"6a92a3ab-87cf-4f2f-8beb-ecb4f8ae4d41"}
  4. If the action is successful, theDownloadAttachment task'sconnectorOutputPayload responseparameter will have a value similar to the following:

    [{"Success":"True","Content":"Test content"}]

Example - Upload an attachment

This example uploads an attachment.

  1. In theConfigure connector task dialog, clickActions.
  2. Select theUploadAttachment action, and then clickDone.
  3. In theTask Input section of theConnectors task, clickconnectorInputPayload and then enter a value similar to the following in theDefault Value field:
    {"Filename":"Xero_Test.txt","ObjectId":"6a92a3ab-87cf-4f2f-8beb-ecb4f8ae4d41","ContentType":"txt","Table":"Contacts","Content":"Test content upload attachment"}
  4. If the action is successful, theUploadAttachment task'sconnectorOutputPayload responseparameter will have a value similar to the following:

    [{"Success":null,"AttachmentId":"5ba982a6-9294-45a7-bdda-5f134b0d69d5","FileName":"Xero_Test.txt","URL":"https://api.xero.com/api.xro/2.0/Contacts/6a92a3ab-87cf-4f2f-8bwb-fcb4f8ae4d41/Attachments/Xero_Test.txt","MimeType":"text/plain","ContentLength":"27","IncludeOnline":null,"_":""},{"Success":null,"AttachmentId":null,"FileName":null,"URL":null,"MimeType":null,"ContentLength":null,"IncludeOnline":null,"_":null}]

Example - List attachments

This example lists the attachments of the specified table.

  1. In theConfigure connector task dialog, clickActions.
  2. Select theListAttachment action, and then clickDone.
  3. In theTask Input section of theConnectors task, clickconnectorInputPayload and then enter a value similar to the following in theDefault Value field:
    {"ObjectId":"6a92a3ab-87cf-4f2f-8beb-ecb4f8ae4d41","Table":"Contacts"}
  4. If the action is successful, theListAttachment task'sconnectorOutputPayload responseparameter will have a value similar to the following:

    [{"AttachmentId":"5ba982a6-9294-45a7-bdda-5f134b0d69d5","FileName":"Xero_Limit_Testing.txt","URL":"https://api.xero.com/api.xro/2.0/Contacts/6a92a3ab-87cf-4f2f-8bwb-fcb4f8ae4d41/Attachments/Xero_Test.txt","MimeType":"text/plain","ContentLength":"27"}]

Example - Send an invoice email

This example sends an email for the specified invoice.

  1. In theConfigure connector task dialog, clickActions.
  2. Select theSendInvoiceMail action, and then clickDone.
  3. In theTask Input section of theConnectors task, clickconnectorInputPayload and then enter a value similar to the following in theDefault Value field:
    {"InvoiceId":"016a64c7-be0b-45a2-acae-13057fdf1566"}
  4. If the action is successful, theSendInvoiceMail task'sconnectorOutputPayload responseparameter will have a value similar to the following:

    [{"Success":"true"}]

Example - Upload a file

This example uploads a file.

  1. In theConfigure connector task dialog, clickActions.
  2. Select theUploadFile action, and then clickDone.
  3. In theTask Input section of theConnectors task, clickconnectorInputPayload and then enter a value similar to the following in theDefault Value field:
    {"Name":"Sample1.txt","Content":"This is a sample file"}
  4. If the action is successful, theUploadFile task'sconnectorOutputPayload responseparameter will have a value similar to the following:

    [{"Success":"true","FileId":"09039c7b-35a2-473d-aa79-16fe00b8d460","Name":"Sample1.txt","FolderId":"36e5115d-a9b6-4c22-baf3-40a8b28ee71d","MimeType":"text/plain","Size":26.0,"User_Id":"c1e33cc9-eb61-45cb-9e46-3ea4121cbdc6","User_Name":"test_user_1@test.com","User_FirstName":"John","User_LastName":"Smith","User_FullName":"John Smith","Created":"2023-12-18 17:38:53.01","Updated":"2023-12-18 17:38:53.01"}]

Entity operation examples

This section shows how to perform some of the entity operations in this connector.

Example - List all records

This example lists all the records in theAccounts entity.

  1. In theConfigure connector task dialog, clickEntities.
  2. SelectAccounts from theEntity list.
  3. Select theList operation, and then clickDone.
  4. Optionally, inTask Input section of theConnectors task, you can filter your result set by specifying afilter clause. For example,City='Bangalore'. You can also specify multiple filter conditions by using the logic operators. For example,City='Bangalore' and region='asia-south2'.

Example - Get an invoice

This example gets an invoice with the specified ID from theInvoices entity.

  1. In theConfigure connector task dialog, clickEntities.
  2. SelectInvoices from theEntity list.
  3. Select theGet operation, and then clickDone.
  4. In theTask Input section of theConnectors task, clickEntityId and then enter1|016a64c7-be0b-45a2-acae-13057fdf1566 in theDefault Value field.

    Here,1|016a64c7-be0b-45a2-acae-13057fdf1566 is a primary key value in theInvoices entity.

Example - Create an invoice

This example creates an invoice in theInvoices entity.

  1. In theConfigure connector task dialog, clickEntities.
  2. SelectInvoices from theEntity list.
  3. Select theCreate operation, and then clickDone.
  4. In theTask Input section of theConnectors task, clickconnectorInputPayload and then enter a value similar to the following in theDefault Value field:
    {"Type":"ACCPAY","ContactName":"ContactName1","LineItem_Description":"LineItemDescription"}

    If the integration is successful, your connector task'sconnectorOutputPayload field will have a value similar to the following:

    {"Id":"1|7b29efe9-dacd-47bb-85a6-0c0640ce25de"}

Example - Update a record

This example updates a record in theAssetTypes entity.

  1. In theConfigure connector task dialog, clickEntities.
  2. SelectAssetTypes from theEntity list.
  3. Select theUpdate operation, and then clickDone.
  4. In theTask Input section of theConnectors task, clickconnectorInputPayload and then enter a value similar to the following in theDefault Value field:
    {"BookDepreciationSetting_DepreciationRate":10.0}
  5. ClickentityId, and then enterf8d43548-25b0-4cc3-8f59-d97106974fe8 in theDefault Value field.

    If the integration is successful, your connector task'sconnectorOutputPayload field will have a value similar to the following:

    {"AssetTypeId":"f8d43548-25b0-4cc3-8f59-d97106974fe8"}

Example - Delete a file

This example deletes the file with the specified ID from theFiles entity.

  1. In theConfigure connector task dialog, clickEntities.
  2. SelectFiles from theEntity list.
  3. Select theDelete operation, and then clickDone.
  4. In theTask Input section of theConnectors task, clickentityId and then enter421c82f0-38fb-4074-a679-63b04c0d8832 in theDefault Value field.
Note:If your entity has a composite primary key, you can specify afilter clause.

After you create the connection, it becomes available in bothApigee Integration and Application Integration. You can use the connectionin an integration through the Connectors task.

  • To understand how to create and use the Connectors task in Apigee Integration, seeConnectors task.
  • To understand how to create and use the Connectors task in Application Integration, seeConnectors task.

Get help from the Google Cloud community

You can post your questions and discuss this connector in the Google Cloudcommunity atCloud Forums.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.