Xero
Xero is cloud-based accounting software designed for small and medium-sized businesses. It provides comprehensive financial management capabilities including invoicing, bank reconciliation, inventory tracking, purchase orders, expense claims, and real-time financial reporting. Xero helps businesses manage their finances efficiently with features like automated bank feeds, multi-currency support, and integrated payroll.
Authentication Types
Xero supports 1 authentication method:
- OAuth - Connect your Xero organization(s) through OAuth 2.0 authentication.
- Pros: Secure, per-user tracking, supports multiple organizations, granular permission control with scopes
- Cons: Requires creating a Xero app in the developer portal
- Best for: All production use cases, organizations requiring secure access with proper authorization
Multi-Tenant Support
Xero is a multi-tenant platform, meaning a single user can have access to multiple organizations (tenants). After completing the OAuth flow, you'll need to:
- Call the Get Connections tool to retrieve the list of authorized organizations
- Each organization has a unique Tenant ID
- Most API calls require this Tenant ID to specify which organization you're working with
The Tenant ID is automatically managed by the connector after authentication.
Setting up OAuth
To use Xero with Webrix, you need to create a Xero app and configure OAuth authentication.
1. Create a Xero App
-
Go to Xero Developer Portal
-
Log in with your Xero account
-
Click New app
-
Fill in the app details:
- App name: Give it a descriptive name (e.g., "Webrix Integration")
- Company or application URL: Your company website
- OAuth 2.0 redirect URIs: Copy the Redirect URI from Webrix and paste it here
tipYou can find the Redirect URI in Webrix when configuring the Xero connector under the OAuth settings. Make sure to copy it exactly as shown.
-
Click Create app
-
After creation, you'll see your app details page
-
Copy the Client ID - you'll need this for Webrix
-
Click Generate a secret to create a Client Secret, then copy it
warningThe client secret is only shown once. If you lose it, you'll need to generate a new one.
2. Configure Scopes
-
In your Xero app settings, go to the OAuth 2.0 tab
-
Under Scopes, ensure the following are enabled based on your needs:
- openid, profile, email - Basic user identity (required)
- offline_access - Refresh token support (required)
- accounting.transactions - Create/update invoices and transactions
- accounting.transactions.read - View invoices and transactions
- accounting.contacts - Create/update contacts
- accounting.contacts.read - View contacts
- accounting.reports.read - View financial reports
- accounting.settings - Manage organization settings
- accounting.settings.read - View organization settings
-
Click Save
3. Configure in Webrix
-
In Webrix, go to Integrations → New → Built-in
-
Select Xero and click Use
-
Under Authentication Type, select OAuth
-
Paste your Client ID from Xero
-
Paste your Client Secret from Xero
-
Click Save Changes
4. Test the Connection
-
After saving, click Connect to test the OAuth flow
-
You'll be redirected to Xero's authorization page
-
Select the organization(s) you want to connect
-
Click Allow access
-
You'll be redirected back to Webrix with a successful connection
-
Use the Get Connections tool to verify which organizations are now accessible
Understanding Access Tokens
- Access Token Expiry: Xero access tokens expire after 30 minutes
- Refresh Tokens: Valid for 60 days if unused
- Automatic Refresh: The connector automatically refreshes tokens before they expire
- Reauthorization: If refresh token expires, users must reconnect through OAuth
Rate Limits
Xero enforces API rate limits to ensure platform stability:
- Non-certified apps: 5,000 API calls per day per organization
- Certified apps: Higher limits available (requires certification process)
- Per-minute limits: 60 calls per minute per organization
If you expect high API usage, consider applying for Xero app certification through the developer portal.
Troubleshooting
Redirect URI Mismatch Error
If you see "redirect_uri_mismatch" error during OAuth authorization.
Cause: The redirect URL configured in your Xero app doesn't match the one being used during the OAuth flow.
Solution:
- Copy the exact Redirect URI from Webrix
- Go to your Xero app → OAuth 2.0 tab → Redirect URIs
- Ensure the URI is added exactly as shown (including https:// and any trailing slashes)
- Remove any extra or incorrect URIs
- Save the changes and try connecting again
Invalid or Missing Tenant ID
API calls fail with "The Xero-Tenant-Id header is required" or "Invalid tenant ID" errors.
Cause: The connector needs to know which organization to access, but the tenant ID is missing or incorrect.
Solution:
- After OAuth, immediately call the Get Connections tool
- This returns all authorized organizations with their tenant IDs
- The connector automatically uses the tenant ID for subsequent calls
- If accessing multiple organizations, ensure you're using the correct tenant ID for each
Token Refresh Failures
Users are repeatedly prompted to reconnect or get "invalid token" errors.
Cause: The refresh token may have expired (60 days of inactivity) or been revoked.
Solution:
- Disconnect and reconnect the Xero integration in Webrix
- Verify that the Xero app hasn't been deleted or had its credentials changed
- Check that your Xero app's OAuth settings haven't been modified
- Ensure users are actively using the integration (at least once every 60 days)
Insufficient Permissions / Scope Errors
API calls fail with "The user does not have permission" or scope-related errors.
Cause: The requested operation requires scopes that weren't granted during OAuth, or the Xero user lacks permissions.
Solution:
- Check that your Xero app has the required scopes enabled in the developer portal
- Verify the user has appropriate permissions in Xero (e.g., Standard or Advisor role)
- Reconnect the integration to request the new scopes
- For write operations, ensure the user has edit permissions in Xero
Rate Limit Exceeded
API requests fail with 429 (Too Many Requests) errors or "Rate limit exceeded" messages.
Cause: Your application has exceeded Xero's API rate limits (5,000 calls/day for non-certified apps, 60 calls/minute).
Solution:
- Implement retry logic with exponential backoff in your workflows
- Cache frequently accessed data (e.g., contacts, accounts, tax rates)
- Use batch operations where possible
- Monitor your API usage through the Xero developer portal
- Consider applying for app certification for higher limits
Organization Not Found
API calls fail with "Organization not found" or similar errors.
Cause: The organization may have been disconnected, the tenant ID is incorrect, or the user no longer has access.
Solution:
- Call Get Connections to verify which organizations are currently accessible
- Check if the organization still exists and is active in Xero
- Verify the user still has access to the organization
- Reconnect the integration if needed
Invoice Status Errors
Cannot update or void invoices with errors about invoice status.
Cause: Xero has strict rules about which operations are allowed based on invoice status:
- DRAFT invoices can be fully edited or deleted
- AUTHORISED invoices have limited edit capabilities
- PAID/VOIDED invoices cannot be modified
Solution:
- Check the invoice status first using Get Invoice
- For DRAFT invoices: use Update Invoice or delete
- For AUTHORISED invoices: use Void Invoice if needed to cancel
- For PAID invoices: create a credit note instead of trying to modify
- Understand the invoice lifecycle before attempting modifications
Multi-Organization Issues
Having trouble working with multiple Xero organizations.
Cause: Not properly handling tenant IDs or switching between organizations.
Solution:
- Always call Get Connections first to see all available organizations
- Store the tenant ID for each organization you want to work with
- The connector handles tenant ID automatically for each request
- If working with multiple orgs, track which org you're currently accessing
- Some users may only have access to one organization
Common Use Cases
Getting Started
- After OAuth authentication, call Get Connections to see your organizations
- Call Get Organization to retrieve organization details
- Use List Contacts to see your customers and suppliers
- Use List Accounts to see your chart of accounts
Creating an Invoice
- Get the contact ID using List Contacts or Create Contact
- Get account codes using List Accounts
- Call Create Invoice with contact, line items, and amounts
- Optionally call Create Payment to record payment
Reconciling Bank Transactions
- Use List Bank Transactions to see unreconciled transactions
- Match transactions with invoices or create new transactions
- Use Create Bank Transaction for manual entries
- Use Create Payment to link payments to invoices
Financial Reporting
- Use Get Profit & Loss Report for income statement
- Use Get Balance Sheet Report for financial position
- Use Get Trial Balance Report for account balances
- Use Get Bank Summary Report for cash flow analysis