ml-connector
XeroMicrosoft Power BI

Xero and Microsoft Power BI integration

Xero runs your books. Power BI visualizes your business. Connecting the two means your accounting data flows into Power BI dashboards and reports automatically, updated on a schedule you control. Invoices, payments, purchase orders, and journal entries from Xero become tables in Power BI, ready for analysis without manual exports or re-keying. Finance teams see cash flow, aging, and profitability metrics stay current throughout the day.

How Xero works

Xero exposes invoices, contacts, purchase orders, payments, accounts, journal entries, credit notes, and bank transactions through the Xero Accounting API, a REST endpoint at https://api.xero.com/api.xro/2.0/ that returns JSON. Authentication uses OAuth2 authorization code flow with 30-minute access tokens and 60-day refresh tokens. Xero publishes webhooks for invoice, payment, journal entry, and purchase order events, but webhook events contain only the record ID, so ml-connector must follow up with a GET to fetch the full details. Rate limits are 60 calls per minute per tenant and 5000 per day per tenant. Xero requires an organization-specific header (Xero-tenant-id) on every request, and uses page-based pagination with 100 records per page.

How Microsoft Power BI works

Microsoft Power BI exposes datasets, push datasets, reports, and dashboards through its REST API at https://api.powerbi.com/v1.0/myorg/. Authentication uses OAuth2 client credentials (service principal) with tokens that expire every hour. Power BI does not emit webhooks to external systems; it is a destination for data, not a source. To push data, ml-connector defines a push dataset with a schema (table name, column names, data types), then POSTs rows into that dataset on a schedule. Service principals must be granted Member or Admin workspace access, and the Power BI admin must enable service principal API access in the tenant settings. Push datasets have size and latency limits per Microsoft documentation.

What moves between them

The main flow runs from Xero into Power BI. ml-connector polls Xero invoices, payments, purchase orders, and manual journals on a schedule, typically daily or after key business events. It transforms each Xero record into Power BI table rows (one row per invoice, one per payment, etc.), and POSTs them into pre-defined push datasets in Power BI. Historical records and changes are captured, so Power BI reports always reflect current Xero state. Xero is the source of truth; Power BI is read-only analytics. ml-connector never writes financial entries back into Xero.

How ml-connector handles it

ml-connector stores Xero OAuth2 credentials and refreshes the access token every 25 minutes before expiry. It validates the Xero-tenant-id header per customer organization, and uses the Xero webhook signing key (fetched from the Xero Developer portal) to verify webhook authenticity when they arrive, falling back to scheduled polling if webhooks are unavailable. On the Power BI side, ml-connector authenticates with the service principal client ID and secret, obtains a bearer token, and includes it on every API call. It pre-defines push dataset schemas for Invoices, Payments, and PurchaseOrders with column names and data types matching Xero's fields (InvoiceID, InvoiceNumber, Status, TotalAmount, etc.), then POSTs rows in batches. Power BI tokens expire every hour, so ml-connector requests a fresh token before each batch. If a push fails due to a schema mismatch or missing workspace permissions, ml-connector retries with exponential backoff and logs the full error for audit. Xero's 60-per-minute rate limit is observed by queuing requests and spacing them, and failed Xero API calls are retried with jitter.

A real-world example

A growing wholesale distributor uses Xero for invoicing and expense tracking across three regional offices, and Power BI for daily cash flow and aging reports. Before the integration, the finance manager exported invoices from Xero as a spreadsheet three times a week and manually re-entered them into Power BI datasets, spending 3 to 4 hours per week on the task and risking errors when invoices were added or marked paid. With Xero and Power BI connected, invoices flow automatically into Power BI datasets every night, and the aging report updates by 7 AM each day. The finance manager now runs the aging report directly from Power BI without re-keying, and can spot cash flow gaps days earlier.

What you can do

  • Push Xero invoices and credit notes into Power BI datasets, including status, amounts, and customer details, updated daily or on webhook events.
  • Sync Xero payments and bank transactions into Power BI for real-time cash flow and bank reconciliation dashboards.
  • Transform Xero purchase orders into Power BI tables so procurement and payables teams see supplier commitments alongside invoice actuals.
  • Authenticate Xero with OAuth2 and refresh tokens automatically, and Power BI with service principal credentials and hourly token rotation.
  • Handle Xero webhooks for real-time record changes, fall back to polling, and retry failed Power BI pushes with a full audit trail.

Questions

Does ml-connector sync historical data from Xero into Power BI, or only new transactions?
ml-connector pulls historical invoices, payments, and purchase orders from Xero on the first run, up to the date range you specify, and pushes them into Power BI datasets. After that, it updates Power BI with new and changed records on your schedule (daily, per webhook, etc.), so Power BI always reflects Xero's current state. Historical data is captured so your Power BI reports show aging and trends accurately.
What happens if Xero webhooks fail or are not enabled?
ml-connector falls back to scheduled polling if webhooks are unavailable. It queries Xero's Accounting API for invoices, payments, and journals modified since the last check, and pushes the results into Power BI on a cadence you set (e.g., every 4 hours). This ensures Power BI stays current even if webhooks are disabled or unreliable.
Does ml-connector require special permissions in Power BI or Xero?
Yes. In Xero, ml-connector needs the webhook signing key from your app settings in the Xero Developer portal, and OAuth2 credentials (client ID and secret) to refresh tokens. In Power BI, the service principal used by ml-connector must be granted Member or Admin access to the workspace where your push datasets live, and your Power BI admin must enable service principal API access in the tenant settings.

Related integrations

Connect Xero and Microsoft Power BI

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started