You need to programmatically fetch the Reserve Bank of New Zealand’s Official Cash Rate (RBNZ_OCR) and integrate it into pricing, risk, and reporting workflows. By the end of this article, you’ll know exactly how to get the latest and historical RBNZ_OCR values from the Interest Rates API, read effective dates correctly, analyze fluctuations and OHLC, compute spreads and loan metrics, and productionize the integration with caching and business-day handling.
What the RBNZ_OCR represents and how it’s expressed
RBNZ_OCR is the Reserve Bank of New Zealand’s Official Cash Rate benchmark used to influence short-term interest rates in the New Zealand economy. It is a central bank policy rate. In the Interest Rates API, RBNZ_OCR is delivered as a numeric percentage value (for example, 2.75 means 2.75% per annum). You should convert this percentage to a decimal when performing calculations (e.g., r = 2.75% = 0.0275).
RBNZ_OCR appears as a monthly-frequency symbol in the catalogue. Practically, this means the time series is stable across days within a month and updates when the policy rate changes or at the end of the month. The API also provides a date field, and a dates map keyed by symbol, indicating the effective date of the reported rate so you can anchor calculations to the correct business day.
All examples below use the symbol RBNZ_OCR and only the documented endpoints and fields. You can explore more at https://interestratesapi.com and the MCP docs: MCP.
API essentials you need to ship
- Base URL: https://interestratesapi.com/api/v1/
- HTTP method: GET for all endpoints
- Authentication: append ?api_key=YOUR_API_KEY to every request URL (no headers)
- Symbol: RBNZ_OCR (NZD, central bank)
- Publication frequency: monthly in the symbols catalogue; within-month dates reflect effective policy values
- Business days and timing: central bank decisions occur on scheduled dates; use the returned dates map to tie values to effective dates. For monthly symbols, historical requests use the last day with data that month.
- Caching: cache the latest endpoint result until the next policy decision or month-end; include the dates map and ETag/If-None-Match at the HTTP layer if available. For time series, cache per range and invalidate on new policy dates.
Tip: treat the numeric value as a percentage. For rate math, convert to decimal; for displays, keep two decimals and add a percent sign. Always read the dates map to avoid attributing a rate to the wrong day when reconciling accounting or backtesting.
Endpoint 1: Symbols — discover RBNZ_OCR
Use the symbols catalogue to confirm the identifier, category, country, currency, and frequency for RBNZ_OCR. You can also filter the catalogue by category, base currency, or provider.
cURL
curl -s "https://interestratesapi.com/api/v1/latest?api_key=YOUR_API_KEY&symbols=RBNZ_OCR"
Python (requests)
import requests
params = {
'category': 'central_bank',
'base': 'NZD',
'api_key': 'YOUR_API_KEY'
}
resp = requests.get('https://interestratesapi.com/api/v1/symbols', params=params)
catalog = resp.json()
print(catalog)
JavaScript (fetch)
const url = 'https://interestratesapi.com/api/v1/symbols?category=central_bank&base=NZD&api_key=YOUR_API_KEY';
const resp = await fetch(url);
const catalog = await resp.json();
console.log(catalog);
PHP
<?php
$url = 'https://interestratesapi.com/api/v1/symbols?category=central_bank&base=NZD&api_key=YOUR_API_KEY';
$resp = file_get_contents($url);
$catalog = json_decode($resp, true);
print_r($catalog);
?>
Sample JSON response fields
{
"success": true,
"date": "2026-09-30",
"base": "NZD",
"rates": {
"RBNZ_OCR": 2.75
},
"dates": {
"RBNZ_OCR": "2026-09-30"
},
"currencies": {
"RBNZ_OCR": "NZD"
},
"base_filter_note": null
}
Key fields you’ll use: symbol, category, currency_code, frequency, and description. For RBNZ_OCR specifically, confirm it’s present in the central_bank category with NZD currency_code. Use this step to validate identifiers at build time.
Endpoint 2: Latest — fetch the current RBNZ_OCR
Pull the latest RBNZ_OCR value and effective date. Use the dates map to tie the rate to the correct business date, and currencies map to confirm units (NZD for RBNZ_OCR).
cURL (official sample — copy/paste)
Official JSON (verbatim)
How to read this:
- rates is a map: "RBNZ_OCR": 2.75 means 2.75%.
- dates is a map of the effective date per symbol; for monthly symbols, this will be a date within that month (here 2026-09-30).
- currencies confirms the base currency (NZD).
- date at the top-level is the API’s reference date for this snapshot.
Python (requests)
import requests
resp = requests.get(
'https://interestratesapi.com/api/v1/latest',
params={'symbols': 'RBNZ_OCR', 'api_key': 'YOUR_API_KEY'}
)
data = resp.json()
rate_pct = data['rates']['RBNZ_OCR'] # e.g., 2.75
effective_date = data['dates']['RBNZ_OCR'] # e.g., '2026-09-30'
currency = data['currencies']['RBNZ_OCR'] # 'NZD'
print(rate_pct, effective_date, currency)
JavaScript (fetch)
const response = await fetch(
'https://interestratesapi.com/api/v1/latest?symbols=RBNZ_OCR&api_key=YOUR_API_KEY'
);
const data = await response.json();
const ratePct = data.rates['RBNZ_OCR'];
const effectiveDate = data.dates['RBNZ_OCR'];
const ccy = data.currencies['RBNZ_OCR'];
console.log(ratePct, effectiveDate, ccy);
PHP
<?php
$url = 'https://interestratesapi.com/api/v1/latest?symbols=RBNZ_OCR&api_key=YOUR_API_KEY';
$resp = file_get_contents($url);
$data = json_decode($resp, true);
$ratePct = $data['rates']['RBNZ_OCR'];
$effectiveDate = $data['dates']['RBNZ_OCR'];
$ccy = $data['currencies']['RBNZ_OCR'];
echo $ratePct . " " . $effectiveDate . " " . $ccy;
?>
Endpoint 3: Historical — value on a specific date
Use historical when you need the RBNZ_OCR as-of a given calendar date. For monthly symbols, the API returns the last available day in that month (see note below), so your backtests or EOM processes stay consistent.
cURL
Sample JSON
Notes:
- date is the as-of date you requested.
- For monthly symbols, “the last day with data within that month is used.” If you queried 2025-06-15, the OCR value corresponds to the effective June value on its latest day in June.
- rates map and currencies map follow the same shape as latest. Values are expressed as percentages.
Python (requests)
import requests
params = {'date': '2025-06-15', 'symbols': 'RBNZ_OCR', 'api_key': 'YOUR_API_KEY'}
resp = requests.get('https://interestratesapi.com/api/v1/historical', params=params)
hist = resp.json()
print(hist['rates']['RBNZ_OCR'])
JavaScript (fetch)
const url = 'https://interestratesapi.com/api/v1/historical?date=2025-06-15&symbols=RBNZ_OCR&api_key=YOUR_API_KEY';
const resp = await fetch(url);
const hist = await resp.json();
console.log(hist.rates['RBNZ_OCR']);
PHP
<?php
$url = 'https://interestratesapi.com/api/v1/historical?date=2025-06-15&symbols=RBNZ_OCR&api_key=YOUR_API_KEY';
$resp = file_get_contents($url);
$hist = json_decode($resp, true);
echo $hist['rates']['RBNZ_OCR'];
?>
Endpoint 4: Time series — values between two dates
Retrieve a continuous series of RBNZ_OCR values between start and end. Even though RBNZ_OCR is monthly in the catalogue, the time series response structure is keyed by date, and you should rely on the data points returned rather than assuming intra-month updates.
cURL
Sample JSON
Key fields:
- rates.RBNZ_OCR is a date-indexed map of percentage values.
- frequencies gives the sampling frequency returned in the series.
- start_date and end_date echo your request after validation.
Python (requests)
import requests
params = {
'start': '2025-10-15',
'end': '2026-10-15',
'symbols': 'RBNZ_OCR',
'api_key': 'YOUR_API_KEY'
}
resp = requests.get('https://interestratesapi.com/api/v1/timeseries', params=params)
series = resp.json()
row = next(iter(series['rates']['RBNZ_OCR'].items()))
print(row) # (date, value)
JavaScript (fetch)
const url = 'https://interestratesapi.com/api/v1/timeseries?start=2025-10-15&end=2026-10-15&symbols=RBNZ_OCR&api_key=YOUR_API_KEY';
const resp = await fetch(url);
const series = await resp.json();
const entries = Object.entries(series.rates['RBNZ_OCR']);
console.log(entries[0]);
PHP
<?php
$url = 'https://interestratesapi.com/api/v1/timeseries?start=2025-10-15&end=2026-10-15&symbols=RBNZ_OCR&api_key=YOUR_API_KEY';
$resp = file_get_contents($url);
$series = json_decode($resp, true);
print_r(array_slice($series['rates']['RBNZ_OCR'], 0, 1, true));
?>
Endpoint 5: Fluctuation — change statistics for RBNZ_OCR
When you need a quick summary of how the OCR changed over a period, use the fluctuation endpoint to get start/end values, absolute and percentage change, and the high/low across the range. This is useful for reporting, dashboard sparklines, and alert thresholds.
cURL
Sample JSON
Field semantics:
- change and change_pct summarize the move across the interval.
- high and low capture the extrema within the period.
- All values are percentages, not decimals.
Python (requests)
import requests
params = {
'start': '2025-10-15',
'end': '2026-10-15',
'symbols': 'RBNZ_OCR',
'api_key': 'YOUR_API_KEY'
}
resp = requests.get('https://interestratesapi.com/api/v1/fluctuation', params=params)
fx = resp.json()
stats = fx['rates']['RBNZ_OCR']
print(stats['change'], stats['change_pct'])
JavaScript (fetch)
const url = 'https://interestratesapi.com/api/v1/fluctuation?start=2025-10-15&end=2026-10-15&symbols=RBNZ_OCR&api_key=YOUR_API_KEY';
const resp = await fetch(url);
const fx = await resp.json();
console.log(fx.rates['RBNZ_OCR']);
PHP
<?php
$url = 'https://interestratesapi.com/api/v1/fluctuation?start=2025-10-15&end=2026-10-15&symbols=RBNZ_OCR&api_key=YOUR_API_KEY';
$resp = file_get_contents($url);
$fx = json_decode($resp, true);
print_r($fx['rates']['RBNZ_OCR']);
?>
Endpoint 6: OHLC — candlestick-style summaries
OHLC provides open, high, low, and close per period (weekly, monthly, or quarterly). For monthly policy rates like RBNZ_OCR, OHLC is useful when you want a chart-ready summary across months. The data is computed on-the-fly from daily values.
cURL
Sample JSON
Interpretation:
- period (e.g., 2025-01) is the time bucket.
- open, high, low, close are percentage values for that bucket.
- data_points shows how many data rows were aggregated.
Python (requests)
import requests
params = {
'symbols': 'RBNZ_OCR',
'period': 'monthly',
'start': '2025-10-15',
'end': '2026-10-15',
'api_key': 'YOUR_API_KEY'
}
resp = requests.get('https://interestratesapi.com/api/v1/ohlc', params=params)
ohlc = resp.json()
print(ohlc['rates']['RBNZ_OCR'][0])
JavaScript (fetch)
const url = 'https://interestratesapi.com/api/v1/ohlc?symbols=RBNZ_OCR&period=monthly&start=2025-10-15&end=2026-10-15&api_key=YOUR_API_KEY';
const resp = await fetch(url);
const ohlc = await resp.json();
console.log(ohlc.rates['RBNZ_OCR'][0]);
PHP
<?php
$url = 'https://interestratesapi.com/api/v1/ohlc?symbols=RBNZ_OCR&period=monthly&start=2025-10-15&end=2026-10-15&api_key=YOUR_API_KEY';
$resp = file_get_contents($url);
$ohlc = json_decode($resp, true);
print_r($ohlc['rates']['RBNZ_OCR'][0]);
?>
Endpoint 7: Convert — loan interest comparison
The convert endpoint compares the total interest cost of a simple loan at the latest rate for two symbols. You can use it to quantify spreads in money terms without manually implementing the loan calculation pipeline. While RBNZ_OCR is a policy rate and not a retail loan rate, it’s commonly used as a basis for variable product pricing in New Zealand; this endpoint helps quantify differences.
cURL
Sample JSON
The difference object gives you the spread and the absolute savings for the given amount and term. You can use this for decision support when switching benchmarks or evaluating pass-through to lending rates.
Python (requests)
import requests
params = {
'from': 'RBNZ_OCR',
'to': 'ECB_MRO',
'amount': 100000,
'term_months': 12,
'api_key': 'YOUR_API_KEY'
}
resp = requests.get('https://interestratesapi.com/api/v1/convert', params=params)
cmp = resp.json()
print(cmp['difference'])
JavaScript (fetch)
const url = 'https://interestratesapi.com/api/v1/convert?from=RBNZ_OCR&to=ECB_MRO&amount=100000&term_months=12&api_key=YOUR_API_KEY';
const resp = await fetch(url);
const cmp = await resp.json();
console.log(cmp.difference);
PHP
<?php
$url = 'https://interestratesapi.com/api/v1/convert?from=RBNZ_OCR&to=ECB_MRO&amount=100000&term_months=12&api_key=YOUR_API_KEY';
$resp = file_get_contents($url);
$cmp = json_decode($resp, true);
print_r($cmp['difference']);
?>
Error handling, rate limits, and production concerns
All endpoints return JSON with success true/false. Handle common errors:
- 401: Missing or invalid api_key
- 403: Account without active plan
- 404: No symbols matched or no data for requested date/range (may include details)
- 422: Validation error (e.g., wrong date format, invalid symbol)
- 429: Request quota exhausted (inspect Retry-After and X-RateLimit-* headers)
Always validate symbols against /symbols. For historical and timeseries, guard against empty ranges with 404. Respect 429 by backing off using Retry-After.
Caching: store latest responses keyed by symbol and the top-level date and dates map; invalidate when you detect a change in dates[symbol] or a new calendar month. For time series, shard caches by [symbol, start, end]. For OHLC, shard by [symbol, period, start, end]. Use short-lived caches for convert if you need up-to-the-minute comparisons.
How to compute spreads and monthly payments from the returned value
Computing a spread from the API is straightforward. Suppose you fetched latest RBNZ_OCR and another benchmark X. Then:
- spread_percentage = rate_pct_RBNZ_OCR − rate_pct_X (both in percentage units)
- spread_decimal = spread_percentage / 100.0
For a loan with principal A and simple interest based on an annual percentage rate r_pct and term T months:
- r_decimal = r_pct / 100
- total_interest_simple ≈ A × r_decimal × (T / 12)
- total_payment_simple = A + total_interest_simple
If you need an amortizing monthly payment at rate r_pct (APR) over T months (nominal compounding monthly), use the standard annuity formula with the monthly rate m = r_decimal / 12:
- payment = A × [m × (1 + m)^T] / [(1 + m)^T − 1]
Always use the dates map to ensure the rate aligns with your contract’s reset date. For policy-linked products, you may apply an internal spread or margin to RBNZ_OCR before pricing; compute that margin as margin = product_rate_pct − RBNZ_OCR_pct.
Real-world use cases with RBNZ_OCR
- Interest rate dashboards: show the latest OCR with the effective date, sparkline using fluctuation or time series, and OHLC for month-over-month context.
- Loan comparison tools: use convert to translate benchmark differences into total interest impact for a notional amount and term.
- Macro research: pull historical and time series to measure the impact window around policy decisions; combine with high/low and change_pct.
- Risk models: use daily-indexed time series output to align with portfolio valuation dates; cache and reconcile using the dates map.
See more capabilities at https://interestratesapi.com. To integrate across environments, consult the MCP.
Putting it all together: end-to-end fetch pipeline
For production use with RBNZ_OCR:
- Validate the symbol via /symbols (once at deploy time, then periodically).
- Fetch /latest for RBNZ_OCR and cache the tuple (rate_pct, dates[symbol], currencies[symbol]).
- For analytics, fetch /timeseries or /ohlc for defined windows (e.g., last 12 months), caching by range.
- For reporting changes, fetch /fluctuation for the reporting period.
- If you need money impact, use /convert for quick comparisons or implement the payment formulas using the rate in decimal.
- Implement error handling for 401/403/404/422/429 and respect Retry-After for 429.
Remember: all requests are GET and must include api_key as a query parameter. No headers, no POST/PUT/DELETE. Base URL is always https://interestratesapi.com/api/v1/.
Troubleshooting and field-by-field checks
- If the number looks off by 100x, confirm you aren’t treating a percentage as a decimal. Convert by dividing by 100 for calculations.
- If dates don’t match your ledger, use data.dates['RBNZ_OCR'] rather than the top-level date for symbol-specific effective dates.
- If your historical mid-month query shows a month-end effective date: this is expected behavior for monthly symbols (last day with data in that month is used).
- If you get 404 for a time window, shrink the window or inspect details for available ranges.
Security and deployment notes
- Store YOUR_API_KEY securely (env var or secret manager). Never commit it to source control.
- Use server-side calls for critical operations; if you must call from a client app, proxy through your backend to protect the key.
- Instrument logging around success, error types, and timing. Monitor X-RateLimit-* headers to avoid 429s.
- Document units and conventions in your code (percent vs. decimal) to prevent downstream errors.
FAQ
Q: Are RBNZ_OCR values returned as percentages or decimals?
A: Percentages. Convert by dividing by 100 for math, and multiply by 100 to display with a percent sign.
Q: Which date should I display: the top-level date or dates['RBNZ_OCR']?
A: Use dates['RBNZ_OCR'] for the symbol’s effective date. The top-level date is the snapshot’s reference date and may be broader than the symbol’s effective date.
Q: How often does RBNZ_OCR update?
A: The symbol is monthly in the catalogue. The API reflects policy decision updates with an effective date; within historical queries, the last day with data in the month is used.
Q: How do I compute month-over-month change?
A: Either fetch two month-end dates with /historical and subtract the percentage values, or call /fluctuation with start and end spanning the months to get change and change_pct directly.
Q: What should I cache?
A: Cache /latest by symbol until the next effective date (compare dates map). Cache /timeseries, /fluctuation, and /ohlc by their parameterized ranges. Evict on policy updates or at month-end.
Ship your RBNZ_OCR integration with confidence. Explore more endpoints and production patterns in the MCP, and create your key now: Register. You can also visit interestratesapi.com for an overview.