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.viewerroles/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
- Go toXero account to signup for a free Xero account.
- Go toXero Demo Company to enable the Xero demo company.
Generate OAuth2.0 client authentication details
- Login to theXero developer account.
- ClickSign Up and follow the prompts. If you already have an account, log in with your credentials.
- Go to theXero developer portal fromMy Apps section in the Developer dashboard.
- ClickNew App orCreate a new app to create a new app.
- 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.
- Make sure to select the appropriate app type and permissions required for your integration with Xero's demo company.
- Store the client ID and client secret in a secured location for future use.
You will be directed to the Xero developer dashboard after logging in.
After you create your app, you will get the OAuth credentials, including a client ID and client secret.
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:
- In theCloud console, go to theIntegration Connectors > Connections page and then select or create a Google Cloud project.
- Click+ Create new to open theCreate Connection page.
- In theLocation section, choose the location for the connection.
- Region: Select a location from the drop-down list.
Supported regions for connectors include:
For the list of all the supported regions, seeLocations.
- ClickNext.
- Region: Select a location from the drop-down list.
- In theConnection Details section, complete the following:
- Connector: SelectXero from the drop down list of available Connectors.
- Connector version: Select the Connector version from the drop down list of available versions.
- 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.
- Optionally, enter aDescription for the connection instance.
- Optionally, enableCloud logging, and then select a log level. By default, the log level is set to
Error. - Service Account: Select a service account that has therequired roles.
- 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.
Note: You can customize the connection node values only if you are a Pay-as-you-go customer. - Schema: The Xero API you want to access as a database schema.
- Tenant: Sets the Xero organization to connect to. Can be a name or tenant ID.
- Verbosity Level: Verbosity level for connection, varies from 1-5. Higher verbosity level will log all the communication details (request,response & ssl certificates).
- Optionally, click+ Add label to add a label to the Connection in the form of a key/value pair.
- ClickNext.
- In theAuthentication section, enter the authentication details.
- 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
- ClickNext.
To understand how to configure these authentication types, seeConfigure authentication.
- Select anAuthentication type and enter the relevant details.
- Review: Review your connection and authentication details.
- 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 name | Details |
|---|---|
| Region | us-central1 |
| Connector | Xero |
| Connector version | 1 |
| Connection Name | google-cloud-xero-accounting-connection |
| Service Account | SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com |
| Schema | ACCOUNTING |
| Verbosity Level | 5 |
| Minimum number of nodes | 2 |
| Maximum number of nodes | 50 |
| Authentication | OAuth 2.0 - Authorization code |
| Client Id | CLIENT_ID |
| Scopes | offline_access openid profile email accounting.transactions, accounting.reports.read, accounting.attachments, accounting.journals.read, accounting.settings, accounting.contacts, accounting.budgets.read |
| Client secret | CLIENT_SECRET |
| Secret Version | 1 |
| Authorization URL | https://login.xero.com/identity/connect/authorize |
Assets server connection type
| Field name | Details |
|---|---|
| Region | us-central1 |
| Connector | Xero |
| Connector version | 1 |
| Connection Name | google-cloud-xero-assets-connection |
| Service Account | SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com |
| Schema | ASSETS |
| Verbosity Level | 5 |
| Minimum number of nodes | 2 |
| Maximum number of nodes | 50 |
| Authentication | OAuth 2.0 - Authorization code |
| Client Id | CLIENT_ID |
| Scopes | assets.read, assets |
| Client secret | CLIENT_SECRET |
| Secret Version | 1 |
| Authorization URL | https://login.xero.com/identity/connect/authorize |
Files server connection type
| Field name | Details |
|---|---|
| Region | us-central1 |
| Connector | Xero |
| Connector version | 1 |
| Connection Name | google-cloud-xero-files-connection |
| Service Account | SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com |
| Schema | FILES |
| Verbosity Level | 5 |
| Minimum number of nodes | 2 |
| Maximum number of nodes | 50 |
| Authentication | OAuth 2.0 - Authorization code |
| Client Id | CLIENT_ID |
| Scopes | files, files.read |
| Client secret | CLIENT_SECRET |
| Secret Version | 1 |
| Authorization URL | https://login.xero.com/identity/connect/authorize |
Payrollaus server connection type
| Field name | Details |
|---|---|
| Region | us-central1 |
| Connector | Xero |
| Connector version | 1 |
| Connection Name | google-cloud-xero-payroll-connection |
| Service Account | SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com |
| Schema | PAYROLLAUS |
| Verbosity Level | 5 |
| Minimum number of nodes | 2 |
| Maximum number of nodes | 50 |
| Authentication | OAuth 2.0 - Authorization code |
| Client Id | CLIENT_ID |
| Scopes | payroll.employees, payroll.payruns, payroll.payslip, payroll.timesheets, payroll.settings |
| Client secret | CLIENT_SECRET |
| Secret Version | 1 |
| Authorization URL | https://login.xero.com/identity/connect/authorize |
Projects server connection type
| Field name | Details |
|---|---|
| Region | us-central1 |
| Connector | Xero |
| Connector version | 1 |
| Connection Name | google-cloud-xero-projects-connection |
| Service Account | SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com |
| Schema | PROJECTS |
| Verbosity Level | 5 |
| Minimum number of nodes | 2 |
| Maximum number of nodes | 50 |
| Authentication | OAuth 2.0 - Authorization code |
| Client Id | CLIENT_ID |
| Scopes | projects, projects.read |
| Client secret | CLIENT_SECRET |
| Secret Version | 1 |
| Authorization URL | https://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 the
Entitieslist 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 the
Operationslist. - 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 the
Actionslist will be empty.
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 name | Data type | Required | Description |
|---|---|---|---|
| Filename | String | No | Name of the attachment to download. |
| Table | String | No | Name of the table from where we have to download the attachment. |
| ObjectId | String | No | ObjectId 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 name | Data type | Required | Description |
|---|---|---|---|
| Filename | String | No | Name of the attachment to upload. |
| ObjectId | String | No | ObjectId of the attachment. |
| ContentType | String | No | Content type of the attachment. |
| Table | String | No | Name of the table in which the attachment should be uploaded. |
| Content | String | No | Content 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 name | Data type | Required | Description |
|---|---|---|---|
| ObjectId | String | No | Object ID of the attachment. |
| Table | String | No | Name 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 name | Data type | Required | Description |
|---|---|---|---|
| InvoiceId | String | No | Id 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 name | Data type | Required | Description |
|---|---|---|---|
| Name | String | No | Name of the file to be uploaded. |
| Content | String | No | File 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.
- In the
Configure connector taskdialog, clickActions. - Select the
DownloadAttachmentaction, and then clickDone. - In theTask Input section of theConnectors task, click
connectorInputPayloadand then enter a value similar to the following in theDefault Valuefield:{"Filename":"Xero_Test.txt","Table":"Contacts","ObjectId":"6a92a3ab-87cf-4f2f-8beb-ecb4f8ae4d41"}
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.
- In the
Configure connector taskdialog, clickActions. - Select the
UploadAttachmentaction, and then clickDone. - In theTask Input section of theConnectors task, click
connectorInputPayloadand then enter a value similar to the following in theDefault Valuefield:{"Filename":"Xero_Test.txt","ObjectId":"6a92a3ab-87cf-4f2f-8beb-ecb4f8ae4d41","ContentType":"txt","Table":"Contacts","Content":"Test content upload attachment"}
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.
- In the
Configure connector taskdialog, clickActions. - Select the
ListAttachmentaction, and then clickDone. - In theTask Input section of theConnectors task, click
connectorInputPayloadand then enter a value similar to the following in theDefault Valuefield:{"ObjectId":"6a92a3ab-87cf-4f2f-8beb-ecb4f8ae4d41","Table":"Contacts"}
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.
- In the
Configure connector taskdialog, clickActions. - Select the
SendInvoiceMailaction, and then clickDone. - In theTask Input section of theConnectors task, click
connectorInputPayloadand then enter a value similar to the following in theDefault Valuefield:{"InvoiceId":"016a64c7-be0b-45a2-acae-13057fdf1566"}
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.
- In the
Configure connector taskdialog, clickActions. - Select the
UploadFileaction, and then clickDone. - In theTask Input section of theConnectors task, click
connectorInputPayloadand then enter a value similar to the following in theDefault Valuefield:{"Name":"Sample1.txt","Content":"This is a sample file"}
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.
- In the
Configure connector taskdialog, clickEntities. - Select
Accountsfrom theEntitylist. - Select the
Listoperation, and then clickDone. - 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.
- In the
Configure connector taskdialog, clickEntities. - Select
Invoicesfrom theEntitylist. - Select the
Getoperation, and then clickDone. - In theTask Input section of theConnectors task, clickEntityId and then enter
1|016a64c7-be0b-45a2-acae-13057fdf1566in theDefault Value field.Here,
1|016a64c7-be0b-45a2-acae-13057fdf1566is a primary key value in theInvoicesentity.
Example - Create an invoice
This example creates an invoice in theInvoices entity.
- In the
Configure connector taskdialog, clickEntities. - Select
Invoicesfrom theEntitylist. - Select the
Createoperation, and then clickDone. - In theTask Input section of theConnectors task, click
connectorInputPayloadand then enter a value similar to the following in theDefault Valuefield:{"Type":"ACCPAY","ContactName":"ContactName1","LineItem_Description":"LineItemDescription"}
If the integration is successful, your connector task's
connectorOutputPayloadfield 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.
- In the
Configure connector taskdialog, clickEntities. - Select
AssetTypesfrom theEntitylist. - Select the
Updateoperation, and then clickDone. - In theTask Input section of theConnectors task, click
connectorInputPayloadand then enter a value similar to the following in theDefault Valuefield:{"BookDepreciationSetting_DepreciationRate":10.0}
- ClickentityId, and then enter
f8d43548-25b0-4cc3-8f59-d97106974fe8in theDefault Value field.If the integration is successful, your connector task's
connectorOutputPayloadfield 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.
- In the
Configure connector taskdialog, clickEntities. - Select
Filesfrom theEntitylist. - Select the
Deleteoperation, and then clickDone. - In theTask Input section of theConnectors task, clickentityId and then enter
421c82f0-38fb-4074-a679-63b04c0d8832in theDefault Value field.
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
- Understand how tosuspend and resume a connection.
- Understand how tomonitor connector usage.
- Understand how toview connector logs.
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.