How to Integrate CNB Data into Your App: Complete API Guide

How to Integrate CNB Data into Your App: Complete API Guide

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 this domain is the interest rate data provided by central banks. This blog post will guide you through integrating the Czech National Bank (CNB) Repo Rate data into your applications using the Interest Rates API. We will cover the essential endpoints, provide code examples, and discuss best practices for effective implementation.

Understanding the Importance of Interest Rate Data

Interest rates are a fundamental aspect of the financial ecosystem, influencing everything from loan costs to investment decisions. The CNB Repo Rate, specifically, serves as a benchmark for monetary policy in the Czech Republic. By integrating this data into your applications, you can provide users with insights into economic conditions, enhance financial modeling, and improve decision-making processes.

API Overview

The Interest Rates API provides a comprehensive suite of endpoints to access various interest rate data, including the CNB Repo Rate. Below, we will explore the seven key endpoints that you will use to integrate this data into your application:

  • /symbols - Retrieve a catalogue of available rate symbols.
  • /latest - Get the latest value for specified symbols.
  • /historical - Access historical data for a specific date.
  • /timeseries - Fetch a series of data between two dates.
  • /fluctuation - Analyze change statistics over a specified range.
  • /ohlc - Obtain OHLC candlestick data.
  • /convert - Compare loan interest costs between two rates.

Step 1: Retrieve Available Symbols

The first step in integrating the CNB Repo Rate is to retrieve the available symbols using the /symbols endpoint. This will help you confirm that the CNB Repo Rate is available for use.

Endpoint: /symbols

To get the list of available symbols, you can use the following cURL command:

curl "https://interestratesapi.com/api/v1/symbols?category=central_bank&base=CZK&api_key=YOUR_KEY"

The expected JSON response will look like this:


{
"success": true,
"count": 1,
"symbols": [
{
"symbol": "CNB_REPO_RATE",
"name": "Czech National Bank Repo Rate",
"category": "central_bank",
"country_code": "CZ",
"currency_code": "CZK",
"frequency": "monthly",
"description": "The interest rate at which the Czech National Bank lends to commercial banks."
}
]
}

Step 2: Fetch Latest CNB Repo Rate

Once you have confirmed the availability of the CNB Repo Rate, the next step is to fetch the latest rate using the /latest endpoint.

Endpoint: /latest

Use the following cURL command to retrieve the latest CNB Repo Rate:

curl "https://interestratesapi.com/api/v1/latest?symbols=CNB_REPO_RATE&api_key=YOUR_KEY"

The expected JSON response will be structured as follows:


{
"success": true,
"date": "2026-07-25",
"base": "CZK",
"rates": {
"CNB_REPO_RATE": 5.33
},
"dates": {
"CNB_REPO_RATE": "2026-07-25"
},
"currencies": {
"CNB_REPO_RATE": "CZK"
}
}

Step 3: Access Historical Data

To analyze trends over time, you may want to access historical data for the CNB Repo Rate. This can be done using the /historical endpoint.

Endpoint: /historical

Here’s how to retrieve historical data for a specific date:

curl "https://interestratesapi.com/api/v1/historical?date=2025-06-15&symbols=CNB_REPO_RATE&api_key=YOUR_KEY"

The JSON response will provide the historical rate for the specified date:


{
"success": true,
"date": "2025-06-15",
"base": "CZK",
"rates": {
"CNB_REPO_RATE": 5.33
},
"currencies": {
"CNB_REPO_RATE": "CZK"
}
}

Step 4: Retrieve Time Series Data

For a more comprehensive analysis, you can fetch a time series of the CNB Repo Rate over a specified date range using the /timeseries endpoint.

Endpoint: /timeseries

Use the following command to get a time series of the CNB Repo Rate:

curl "https://interestratesapi.com/api/v1/timeseries?start=2025-07-25&end=2026-07-25&symbols=CNB_REPO_RATE&api_key=YOUR_KEY"

The expected JSON response will include daily rates within the specified range:


{
"success": true,
"base": "CZK",
"start_date": "2025-07-25",
"end_date": "2026-07-25",
"rates": {
"CNB_REPO_RATE": {
"2025-07-25": 5.33,
"2025-07-26": 5.33
}
},
"frequencies": {
"CNB_REPO_RATE": "daily"
},
"currencies": {
"CNB_REPO_RATE": "CZK"
}
}

Step 5: Analyze Fluctuations

Understanding how the CNB Repo Rate fluctuates over time can provide valuable insights. The /fluctuation endpoint allows you to analyze these changes over a specified date range.

Endpoint: /fluctuation

To analyze fluctuations, use the following command:

curl "https://interestratesapi.com/api/v1/fluctuation?start=2025-07-25&end=2026-07-25&symbols=CNB_REPO_RATE&api_key=YOUR_KEY"

The JSON response will include statistics about the rate changes:


{
"success": true,
"rates": {
"CNB_REPO_RATE": {
"start_date": "2025-07-25",
"end_date": "2026-07-25",
"start_value": 5.50,
"end_value": 5.33,
"change": -0.17,
"change_pct": -3.09,
"high": 5.50,
"low": 5.25
}
}
}

Step 6: Obtain OHLC Data

For applications that require candlestick data, the /ohlc endpoint provides Open, High, Low, and Close (OHLC) data for the CNB Repo Rate.

Endpoint: /ohlc

To retrieve OHLC data, use the following command:

curl "https://interestratesapi.com/api/v1/ohlc?symbols=CNB_REPO_RATE&period=monthly&start=2025-07-25&end=2026-07-25&api_key=YOUR_KEY"

The expected JSON response will provide the OHLC data:


{
"success": true,
"period": "monthly",
"start_date": "2025-07-25",
"end_date": "2026-07-25",
"rates": {
"CNB_REPO_RATE": [
{
"period": "2025-07",
"open": 5.50,
"high": 5.50,
"low": 5.33,
"close": 5.33,
"data_points": 23
}
]
}
}

Step 7: Compare Loan Interest Costs

Finally, the /convert endpoint allows you to compare the total interest costs of loans based on different rates, which can be particularly useful for financial applications.

Endpoint: /convert

To compare the CNB Repo Rate with another rate, use the following command:

curl "https://interestratesapi.com/api/v1/convert?from=CNB_REPO_RATE&to=ECB_MRO&amount=100000&term_months=12&api_key=YOUR_KEY"

The JSON response will provide a detailed comparison:


{
"success": true,
"amount": 100000,
"term_months": 12,
"from": {
"symbol": "CNB_REPO_RATE",
"rate": 5.33,
"date": "2026-07-25",
"total_interest": 5330.00,
"total_payment": 105330.00
},
"to": {
"symbol": "ECB_MRO",
"rate": 4.50,
"date": "2026-07-25",
"total_interest": 4500.00,
"total_payment": 104500.00
},
"difference": {
"rate_spread": 0.83,
"interest_saved": 830.00
}
}

Error Handling

When working with the Interest Rates API, it's essential to handle errors gracefully. Here are some common error responses you may encounter:

  • 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.

For rate limit errors (429), the response will include headers such as:

  • X-RateLimit-Limit: The maximum number of requests allowed in a given time period.
  • X-RateLimit-Remaining: The number of requests remaining in the current time window.
  • X-RateLimit-Reset: The time when the rate limit will reset.

Mini Project: Node.js/Express Endpoint

To demonstrate how to integrate the CNB Repo Rate data into a Node.js application, we will create a simple Express endpoint that fetches and serves the latest CNB Repo Rate.

const express = require('express');
const fetch = require('node-fetch');
const app = express();
const PORT = process.env.PORT || 3000;

app.get('/latest-cnb-rate', async (req, res) => {
try {
const response = await fetch('https://interestratesapi.com/api/v1/latest?symbols=CNB_REPO_RATE&api_key=YOUR_KEY');
const data = await response.json();
res.json(data);
} catch (error) {
res.status(500).json({ error: 'Failed to fetch data' });
}
});

app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});

This simple endpoint fetches the latest CNB Repo Rate and serves it as JSON. You can expand this project by adding caching mechanisms, error handling, and more endpoints as needed.

Conclusion

Integrating the CNB Repo Rate data into your applications using the Interest Rates API is a straightforward process that can significantly enhance your financial applications. By following the steps outlined in this guide, you can access a wealth of interest rate data, analyze trends, and provide valuable insights to your users. For more information and to explore additional features, visit Explore Interest Rates API features and Get started with Interest Rates API.

Ready to get started?

Get your API key and start validating bank data in minutes.

Get API Key

Related posts