How to Use RBA Exchange Rates in Xero Instead of XE.com Rates
Xero behaves differently from most accounting systems. Its organisation-wide daily rates come from XE.com, and you can't overwrite that table with your own source. If your accountant or auditor expects RBA rates, that leaves you editing rates by hand on each transaction.
What Xero does let you do is set the CurrencyRate on each multi-currency transaction (invoices, bills, bank transactions and credit notes) through the Xero Accounting API. If you leave CurrencyRate out, Xero uses its own rate. So the way to use RBA rates in Xero is to set the rate on each transaction as you create it.
Using a different system? See the ERP integration overview for SAP, NetSuite, Business Central, Odoo and Excel.
Before You Start
The API returns rates as units of foreign currency per 1 AUD, which is how the RBA publishes them:
{
"success": true,
"timestamp": 1725080400,
"base": "AUD",
"date": "2025-08-31",
"rates": {
"USD": 0.643512,
"EUR": 0.562934,
"JPY": 96.8321
}
}
Handily, Xero expresses rates the same way: 1 AUD = x foreign. You can pass the API's value straight through without inverting it.
The one thing to plan for is weekends and public holidays. The RBA doesn't publish on those days, and a request to GET /{date} for one of them returns 404. An invoice dated on a Saturday still needs a rate, so the example below asks the /timeseries endpoint for the few days before the transaction date and takes the latest published rate.
Creating an Invoice at the RBA Rate
Here's a Node.js example that creates a USD sales invoice at the RBA rate for the invoice date:
const RBA_API = 'https://api.exchangeratesapi.com.au';
const RBA_KEY = process.env.RBA_API_KEY;
// Most recent RBA rate on or before `date` (handles weekends & public holidays)
async function rbaRateOnOrBefore(currency, date) {
const end = new Date(`${date}T00:00:00Z`);
const start = new Date(end);
start.setUTCDate(start.getUTCDate() - 6); // 7-day window covers any long weekend
const params = new URLSearchParams({
start_date: start.toISOString().slice(0, 10),
end_date: date,
symbols: currency,
});
const res = await fetch(`${RBA_API}/timeseries?${params}`, {
headers: { Authorization: `Bearer ${RBA_KEY}` },
});
if (!res.ok) throw new Error(`Exchange Rates API returned ${res.status}`);
const { rates } = await res.json();
const latestDate = Object.keys(rates).sort().pop();
if (!latestDate) throw new Error(`No RBA rate for ${currency} near ${date}`);
return { rate: rates[latestDate][currency], rbaDate: latestDate };
}
async function createInvoiceAtRbaRate({ accessToken, tenantId, contactId, date, dueDate, lineItems }) {
const { rate, rbaDate } = await rbaRateOnOrBefore('USD', date);
const res = await fetch('https://api.xero.com/api.xro/2.0/Invoices', {
method: 'POST',
headers: {
Authorization: `Bearer ${accessToken}`, // Xero OAuth 2.0 token
'xero-tenant-id': tenantId,
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({
Invoices: [
{
Type: 'ACCREC',
Contact: { ContactID: contactId },
Date: date,
DueDate: dueDate,
CurrencyCode: 'USD',
CurrencyRate: rate, // 1 AUD = rate USD, same direction as Xero
Reference: `RBA rate ${rbaDate}`, // audit trail
LineItems: lineItems,
Status: 'DRAFT',
},
],
}),
});
if (!res.ok) throw new Error(`Xero returned ${res.status}: ${await res.text()}`);
return res.json();
}
Practical Notes
- Leave an audit trail. Putting the RBA date in the reference (or a tracking field) lets your accountant tie each rate back to the RBA table.
- Bills too. The same
CurrencyRatefield works onACCPAYinvoices, bank transactions and credit notes. - Cache rates per day. If you create many transactions, fetch each day's rates once and reuse them rather than calling the API for every invoice.
- Check it once. Create one test invoice in the Xero demo company and confirm the rate in the Xero UI shows as 1 AUD = 0.6435 USD (or whatever the current rate is) before rolling out.
Before You Go Live
- Keep secrets out of code. Store the API key and Xero OAuth credentials in environment variables or your platform's secret store.
- Alerting. If rate lookups fail, decide whether to stop or fall back to Xero's own rate, and make sure someone hears about it. The API's
/statusendpoint helps when troubleshooting. - Tell your accountant. Record in your accounting policy that foreign-currency transactions use the RBA's 4 PM AEST rate for the transaction date (or the last published rate before it).
Which Plan Do You Need?
A 7-day /timeseries window works on Starter, which suits most businesses creating transactions as they happen. If you're backfilling older transactions, you'll need Professional or above for history beyond the last 30 days.
Ready to use RBA rates in Xero? Get your free API key and try it against the Xero demo company today.
Data sourced from the Reserve Bank of Australia. We are not affiliated with or endorsed by the Reserve Bank of Australia.
Xero is a trademark of Xero Limited. XE.com is a trademark of its owner. Code samples are provided as starting points. Test them in a demo organisation and review them with your accountant before using them in production.
For API documentation, visit Exchange Rates API Docs