How to Load RBA Exchange Rates into Dynamics 365 Business Central
Business Central stores rates in the Currency Exchange Rate table, one row per currency and starting date. For Australian companies that report in AUD, the usual source is the RBA's daily table, often typed in by hand.
This guide automates that with an AL codeunit that fetches the RBA rates from the Exchange Rates API and runs from the Job Queue every business day.
Using a different system? See the ERP integration overview for SAP, Xero, NetSuite, 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
}
}
Four things to get right for Business Central:
- Direction. Business Central uses a pair of amounts rather than a single rate: Exchange Rate Amount in foreign currency equals Relational Exch. Rate Amount in local currency. With AUD as local currency,
1 AUD = 0.643512 USDbecomes Exchange Rate Amount0.643512and Relational1. You don't have to invert anything. - TWI and SDR. TWI is an index, not a currency, and SDR's ISO code is XDR. The codeunit skips any code that isn't set up as a Currency, so both are ignored unless you've created them.
- Weekends and public holidays. The RBA doesn't publish on those days. Business Central uses the most recent starting date on or before the posting date, so you only need to load the days the RBA publishes. Use the
datefrom the response as the starting date, never today's date. - Timing. The RBA publishes around 4 PM AEST. Schedule the job for 5 PM Sydney time or later on business days.
The AL Codeunit
Add this in a per-tenant extension:
codeunit 50100 "RBA FX Rate Import"
{
trigger OnRun()
begin
ImportLatestRates();
end;
procedure ImportLatestRates()
var
Client: HttpClient;
Response: HttpResponseMessage;
Body: Text;
Root: JsonObject;
Token: JsonToken;
Rates: JsonObject;
CurrencyCode: Text;
StartingDate: Date;
begin
Client.DefaultRequestHeaders.Add('Authorization', 'Bearer ' + GetApiKey());
if not Client.Get('https://api.exchangeratesapi.com.au/latest', Response) then
Error('Could not reach the Exchange Rates API.');
if not Response.IsSuccessStatusCode() then
Error('Exchange Rates API returned status %1.', Response.HttpStatusCode());
Response.Content().ReadAs(Body);
Root.ReadFrom(Body);
Root.Get('date', Token);
Evaluate(StartingDate, Token.AsValue().AsText(), 9); // 9 = XML format, YYYY-MM-DD
Root.Get('rates', Token);
Rates := Token.AsObject();
foreach CurrencyCode in Rates.Keys() do begin
Rates.Get(CurrencyCode, Token);
UpsertRate(CopyStr(CurrencyCode, 1, 10), StartingDate, Token.AsValue().AsDecimal());
end;
end;
local procedure UpsertRate(CurrencyCode: Code[10]; StartingDate: Date; RateFromAud: Decimal)
var
Currency: Record Currency;
ExchRate: Record "Currency Exchange Rate";
begin
// Skips TWI, SDR and any currency not set up in Business Central
if not Currency.Get(CurrencyCode) then
exit;
if not ExchRate.Get(CurrencyCode, StartingDate) then begin
ExchRate.Init();
ExchRate."Currency Code" := CurrencyCode;
ExchRate."Starting Date" := StartingDate;
ExchRate.Insert(true);
end;
// 1 AUD (LCY) = RateFromAud units of foreign currency
ExchRate.Validate("Exchange Rate Amount", RateFromAud);
ExchRate.Validate("Relational Exch. Rate Amount", 1);
ExchRate.Validate("Adjustment Exch. Rate Amount", RateFromAud);
ExchRate.Validate("Relational Adjmt Exch Rate Amt", 1);
ExchRate.Modify(true);
end;
local procedure GetApiKey(): Text
var
ApiKey: Text;
begin
if not IsolatedStorage.Get('RBA_API_KEY', DataScope::Company, ApiKey) then
Error('Set the RBA API key in isolated storage first.');
exit(ApiKey);
end;
}
Scheduling
Create a Job Queue Entry with Object Type to Run = Codeunit, Object ID = 50100, recurring on weekdays with a start time of 17:00.
The codeunit sets the adjustment amounts as well as the exchange rate amounts, so Adjust Exchange Rates revalues open balances with the same RBA rate at month-end.
What About the Built-in Exchange Rate Service?
Business Central also has a Currency Exchange Rate Service page for simple feeds. It expects a feed it can map field by field and doesn't let you send a Bearer token, so the AL route is the reliable option here. It also gives you control over error handling and which currencies get loaded.
Before You Go Live
- Test in a sandbox environment and compare a few rates against the RBA's published table.
- Safe to re-run. The codeunit updates the existing row for a currency and date, so a job that runs twice won't create duplicates.
- Alerting. Set the Job Queue Entry to notify someone on failure, so a missed day is caught before month-end. The API's
/statusendpoint helps when troubleshooting. - Backfill. When you first go live, load historical rates for open periods using
/timeseries. Full history back to 2018 is on Professional and above.
Which Plan Do You Need?
A daily load uses about 22 requests a month, so Starter covers it. Move to Professional if you need history beyond the last 30 days for a backfill, or want a rate-published webhook to trigger the load as soon as rates arrive.
Ready to automate Business Central's exchange rates? Get your free API key and try the codeunit in a sandbox today.
Data sourced from the Reserve Bank of Australia. We are not affiliated with or endorsed by the Reserve Bank of Australia.
Microsoft and Dynamics 365 are trademarks of the Microsoft group of companies. Code samples are provided as starting points. Test them in a sandbox environment and review them with your Business Central partner before using them in production.
For API documentation, visit Exchange Rates API Docs