Introduction
In the rapidly evolving world of fintech, access to accurate and timely financial data is crucial for developers, economists, and analysts. One of the key data points in financial markets is the overnight cash rate, which reflects the interest rate at which banks lend to each other overnight. In this blog post, we will explore how to integrate the New Zealand Dollar Overnight Cash Rate data into your application using the Interest Rates API from interestratesapi.com. This comprehensive guide will cover all the necessary endpoints, provide code examples, and discuss best practices for handling financial time series data.
Understanding the Importance of Overnight Cash Rate Data
The overnight cash rate is a critical indicator of the monetary policy stance of a central bank. It influences other interest rates in the economy, including those for loans, mortgages, and savings. By integrating this data into your application, you can provide users with insights into market trends, assist in financial decision-making, and enhance the overall user experience. Without access to reliable data, developers may struggle to build applications that meet the needs of their users, leading to missed opportunities and inefficiencies.
Getting Started with the Interest Rates API
The Interest Rates API provides a straightforward way to access various interest rate data, including the New Zealand Dollar Overnight Cash Rate. To begin, you will need to familiarize yourself with the API's endpoints and how to authenticate your requests. All requests to the API are made using the GET method, and authentication is handled via the api_key query parameter.
API Endpoints Overview
The Interest Rates API offers several endpoints that allow you to retrieve different types of data. Below is a summary of the key endpoints we will cover:
- /symbols: Retrieve a catalogue of available rate symbols.
- /latest: Get the latest value for specified symbols.
- /historical: Fetch the value of a symbol on a specific date.
- /timeseries: Retrieve a series of values between two dates.
- /fluctuation: Get change statistics over a specified range.
- /ohlc: Access OHLC candlestick data.
- /convert: Compare loan interest costs between two rates.
1. Retrieving Available Symbols
The first step in integrating the API is to retrieve the available symbols. This will help you identify the specific identifiers you can use in subsequent requests. The endpoint for this is /api/v1/symbols.
cURL Example
curl "https://interestratesapi.com/api/v1/symbols?category=central_bank&base=NZD&api_key=YOUR_KEY"
Python Example
import requests
response = requests.get(
'https://interestratesapi.com/api/v1/symbols',
params=dict(category='central_bank', base='NZD', api_key='YOUR_KEY')
)
data = response.json()
JavaScript Example
const response = await fetch(
'https://interestratesapi.com/api/v1/symbols?category=central_bank&base=NZD&api_key=YOUR_KEY'
);
const data = await response.json();
PHP Example
<?php
$api_key = 'YOUR_KEY';
$url = "https://interestratesapi.com/api/v1/symbols?category=central_bank&base=NZD&api_key=$api_key";
$response = file_get_contents($url);
$data = json_decode($response, true);
?>
Response Example
{
"success": true,
"count": 2,
"symbols": [
{
"symbol": "RBNZ_OCR",
"name": "New Zealand Official Cash Rate",
"category": "central_bank",
"country_code": "NZ",
"currency_code": "NZD",
"frequency": "daily",
"description": "The interest rate set by the Reserve Bank of New Zealand"
}
]
}
The response provides a list of available symbols, including the New Zealand Official Cash Rate (RBNZ_OCR), which is essential for our integration.
2. Fetching the Latest Rate
Once you have identified the relevant symbol, the next step is to retrieve the latest rate using the /api/v1/latest endpoint.
cURL Example
curl "https://interestratesapi.com/api/v1/latest?symbols=RBNZ_OCR&api_key=YOUR_KEY"
Python Example
response = requests.get(
'https://interestratesapi.com/api/v1/latest',
params=dict(symbols='RBNZ_OCR', api_key='YOUR_KEY')
)
data = response.json()
JavaScript Example
const response = await fetch(
'https://interestratesapi.com/api/v1/latest?symbols=RBNZ_OCR&api_key=YOUR_KEY'
);
const data = await response.json();
PHP Example
<?php
$api_key = 'YOUR_KEY';
$url = "https://interestratesapi.com/api/v1/latest?symbols=RBNZ_OCR&api_key=$api_key";
$response = file_get_contents($url);
$data = json_decode($response, true);
?>
Response Example
{
"success": true,
"date": "2026-08-13",
"base": "NZD",
"rates": {
"RBNZ_OCR": 5.25
},
"dates": {
"RBNZ_OCR": "2026-08-13"
},
"currencies": {
"RBNZ_OCR": "NZD"
}
}
This response provides the latest value of the New Zealand Official Cash Rate, which can be used in your application to inform users about current interest rates.
3. Accessing Historical Data
To analyze trends over time, you may want to access historical data for the overnight cash rate. This can be done using the /api/v1/historical endpoint.
cURL Example
curl "https://interestratesapi.com/api/v1/historical?date=2025-06-15&symbols=RBNZ_OCR&api_key=YOUR_KEY"
Python Example
response = requests.get(
'https://interestratesapi.com/api/v1/historical',
params=dict(date='2025-06-15', symbols='RBNZ_OCR', api_key='YOUR_KEY')
)
data = response.json()
JavaScript Example
const response = await fetch(
'https://interestratesapi.com/api/v1/historical?date=2025-06-15&symbols=RBNZ_OCR&api_key=YOUR_KEY'
);
const data = await response.json();
PHP Example
<?php
$api_key = 'YOUR_KEY';
$url = "https://interestratesapi.com/api/v1/historical?date=2025-06-15&symbols=RBNZ_OCR&api_key=$api_key";
$response = file_get_contents($url);
$data = json_decode($response, true);
?>
Response Example
{
"success": true,
"date": "2025-06-15",
"base": "NZD",
"rates": {
"RBNZ_OCR": 5.00
},
"currencies": {
"RBNZ_OCR": "NZD"
}
}
This endpoint allows you to retrieve the cash rate for a specific date, enabling you to perform historical analysis and visualize trends over time.
4. Retrieving Time Series Data
For a more comprehensive analysis, you may want to retrieve a series of values over a specified date range. The /api/v1/timeseries endpoint allows you to do this.
cURL Example
curl "https://interestratesapi.com/api/v1/timeseries?start=2025-08-13&end=2026-08-13&symbols=RBNZ_OCR&api_key=YOUR_KEY"
Python Example
response = requests.get(
'https://interestratesapi.com/api/v1/timeseries',
params=dict(start='2025-08-13', end='2026-08-13', symbols='RBNZ_OCR', api_key='YOUR_KEY')
)
data = response.json()
JavaScript Example
const response = await fetch(
'https://interestratesapi.com/api/v1/timeseries?start=2025-08-13&end=2026-08-13&symbols=RBNZ_OCR&api_key=YOUR_KEY'
);
const data = await response.json();
PHP Example
<?php
$api_key = 'YOUR_KEY';
$url = "https://interestratesapi.com/api/v1/timeseries?start=2025-08-13&end=2026-08-13&symbols=RBNZ_OCR&api_key=$api_key";
$response = file_get_contents($url);
$data = json_decode($response, true);
?>
Response Example
{
"success": true,
"base": "NZD",
"start_date": "2025-08-13",
"end_date": "2026-08-13",
"rates": {
"RBNZ_OCR": {
"2025-08-13": 5.25,
"2025-08-14": 5.30,
"2025-08-15": 5.35
}
},
"frequencies": {
"RBNZ_OCR": "daily"
},
"currencies": {
"RBNZ_OCR": "NZD"
}
}
This endpoint provides daily values for the specified date range, allowing you to analyze trends and fluctuations in the cash rate over time.
5. Analyzing Fluctuations
To understand how the cash rate has changed over a specific period, you can use the /api/v1/fluctuation endpoint. This endpoint provides statistics on the rate's fluctuations.
cURL Example
curl "https://interestratesapi.com/api/v1/fluctuation?start=2025-08-13&end=2026-08-13&symbols=RBNZ_OCR&api_key=YOUR_KEY"
Python Example
response = requests.get(
'https://interestratesapi.com/api/v1/fluctuation',
params=dict(start='2025-08-13', end='2026-08-13', symbols='RBNZ_OCR', api_key='YOUR_KEY')
)
data = response.json()
JavaScript Example
const response = await fetch(
'https://interestratesapi.com/api/v1/fluctuation?start=2025-08-13&end=2026-08-13&symbols=RBNZ_OCR&api_key=YOUR_KEY'
);
const data = await response.json();
PHP Example
<?php
$api_key = 'YOUR_KEY';
$url = "https://interestratesapi.com/api/v1/fluctuation?start=2025-08-13&end=2026-08-13&symbols=RBNZ_OCR&api_key=$api_key";
$response = file_get_contents($url);
$data = json_decode($response, true);
?>
Response Example
{
"success": true,
"rates": {
"RBNZ_OCR": {
"start_date": "2025-08-13",
"end_date": "2026-08-13",
"start_value": 5.25,
"end_value": 5.35,
"change": 0.10,
"change_pct": 1.90,
"high": 5.40,
"low": 5.20
}
}
}
This response provides valuable insights into how the cash rate has fluctuated over the specified period, helping users understand market dynamics.
6. Accessing OHLC Data
For applications that require candlestick data, the /api/v1/ohlc endpoint provides Open, High, Low, and Close (OHLC) data for specified symbols.
cURL Example
curl "https://interestratesapi.com/api/v1/ohlc?symbols=RBNZ_OCR&period=monthly&start=2025-08-13&end=2026-08-13&api_key=YOUR_KEY"
Python Example
response = requests.get(
'https://interestratesapi.com/api/v1/ohlc',
params=dict(symbols='RBNZ_OCR', period='monthly', start='2025-08-13', end='2026-08-13', api_key='YOUR_KEY')
)
data = response.json()
JavaScript Example
const response = await fetch(
'https://interestratesapi.com/api/v1/ohlc?symbols=RBNZ_OCR&period=monthly&start=2025-08-13&end=2026-08-13&api_key=YOUR_KEY'
);
const data = await response.json();
PHP Example
<?php
$api_key = 'YOUR_KEY';
$url = "https://interestratesapi.com/api/v1/ohlc?symbols=RBNZ_OCR&period=monthly&start=2025-08-13&end=2026-08-13&api_key=$api_key";
$response = file_get_contents($url);
$data = json_decode($response, true);
?>
Response Example
{
"success": true,
"period": "monthly",
"start_date": "2025-08-13",
"end_date": "2026-08-13",
"rates": {
"RBNZ_OCR": [
{
"period": "2025-08",
"open": 5.25,
"high": 5.35,
"low": 5.20,
"close": 5.30,
"data_points": 30
}
]
}
}
This endpoint is particularly useful for traders and analysts who need to visualize price movements over time.
7. Comparing Loan Interest Costs
Finally, the /api/v1/convert endpoint allows you to compare the total interest cost of loans between two different rates. This can be particularly useful for users looking to make informed financial decisions.
cURL Example
curl "https://interestratesapi.com/api/v1/convert?from=RBNZ_OCR&to=ECB_MRO&amount=100000&term_months=12&api_key=YOUR_KEY"
Python Example
response = requests.get(
'https://interestratesapi.com/api/v1/convert',
params=dict(from='RBNZ_OCR', to='ECB_MRO', amount=100000, term_months=12, api_key='YOUR_KEY')
)
data = response.json()
JavaScript Example
const response = await fetch(
'https://interestratesapi.com/api/v1/convert?from=RBNZ_OCR&to=ECB_MRO&amount=100000&term_months=12&api_key=YOUR_KEY'
);
const data = await response.json();
PHP Example
<?php
$api_key = 'YOUR_KEY';
$url = "https://interestratesapi.com/api/v1/convert?from=RBNZ_OCR&to=ECB_MRO&amount=100000&term_months=12&api_key=$api_key";
$response = file_get_contents($url);
$data = json_decode($response, true);
?>
Response Example
{
"success": true,
"amount": 100000,
"term_months": 12,
"from": {
"symbol": "RBNZ_OCR",
"rate": 5.25,
"date": "2026-08-13",
"total_interest": 5250.00,
"total_payment": 105250.00
},
"to": {
"symbol": "ECB_MRO",
"rate": 4.50,
"date": "2026-08-13",
"total_interest": 4500.00,
"total_payment": 104500.00
},
"difference": {
"rate_spread": 0.75,
"interest_saved": 750.00
}
}
This endpoint provides a detailed comparison of the total interest costs associated with different rates, helping users make informed financial decisions.
Error Handling and Rate Limits
When working with APIs, it's essential to handle errors gracefully. The Interest Rates API may return various error codes, including:
- 401: Missing or invalid
api_key. - 403: Account without an active plan.
- 404: No symbols matched or no data for the requested date/range.
- 422: Validation error (e.g., wrong date format, invalid symbol).
- 429: Request quota exhausted.
To manage rate limits, the API provides the following headers in the response:
- X-RateLimit-Limit: The maximum number of requests that can be made in a given time period.
- X-RateLimit-Remaining: The number of requests remaining in the current time period.
- X-RateLimit-Reset: The time when the rate limit will reset.
By monitoring these headers, you can implement logic in your application to handle rate limits effectively, such as retrying requests after a specified delay.
Building a Mini Project: Node.js/Express Endpoint
To demonstrate the practical application of the Interest Rates API, let's build a simple Node.js/Express endpoint that fetches, caches, and serves the New Zealand Official Cash Rate data.
Setting Up the Project
First, create a new Node.js project and install the necessary dependencies:
mkdir interest-rate-api
cd interest-rate-api
npm init -y
npm install express axios node-cache
Creating the Express Server
Next, create a file named server.js and add the following code:
const express = require('express');
const axios = require('axios');
const NodeCache = require('node-cache');
const app = express();
const cache = new NodeCache();
const API_KEY = 'YOUR_KEY';
app.get('/api/rbnz-ocr', async (req, res) => {
const cacheKey = 'RBNZ_OCR';
const cachedData = cache.get(cacheKey);
if (cachedData) {
return res.json(cachedData);
}
try {
const response = await axios.get(`https://interestratesapi.com/api/v1/latest?symbols=RBNZ_OCR&api_key=${API_KEY}`);
cache.set(cacheKey, response.data, 3600); // Cache for 1 hour
return res.json(response.data);
} catch (error) {
return res.status(500).json({ error: 'Failed to fetch data' });
}
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});
This simple Express server fetches the latest New Zealand Official Cash Rate from the Interest Rates API and caches the result for one hour. This reduces the number of API calls and improves response times for users.
Conclusion
Integrating the New Zealand Dollar Overnight Cash Rate data into your application using the Interest Rates API from interestratesapi.com is a straightforward process that can significantly enhance your application's functionality. By leveraging the various endpoints available, you can provide users with valuable insights into interest rates, historical trends, and financial comparisons.
For more information and to explore additional features, visit Explore Interest Rates API features and Get started with Interest Rates API.




