Skip to Content
Rates API
API Reference

API Reference

The base URL, endpoints, filters, errors, and time-series rules for New Zealand mortgage, personal loan, car loan, and credit card rates.

Use this section when you know which data you must get. The OpenAPI reference shows the parameters, the response fields, and the errors of each endpoint. If Rates API is new to you, start with the Quickstart. Then read AI Integration and Core Concepts.

Base URL

https://www.ratesapi.nz

For local development, use this URL:

http://localhost:8787

Authentication

An API key is not necessary.

OpenAPI Reference

The OpenAPI reference shows all parameters, response fields, and errors of each endpoint. You can also send requests from it.

ResourceURL
OpenAPI reference (Scalar)/openapi
OpenAPI JSON/openapi.json

AI Integration

ResourceURLUse
MCP endpointPOST /api/v1/mcpFind and use tools from an MCP client
OpenAPI JSON/openapi.jsonMake tools and SDKs, and examine the contract
Documentation list for LLMs/llms.txtGive an assistant a plain-text list of the documentation pages

For more information about MCP, llms.txt, and agent patterns, read AI Integration.

Endpoint Groups

Each category has three endpoints:

  • The list endpoint gives the newest rates of all institutions or issuers.
  • The detail endpoint gives the newest rates of one institution or issuer.
  • The time-series endpoint gives snapshots of earlier rates.
CategoryList EndpointGet By IDTime Series
Mortgage RatesGET /api/v1/mortgage-ratesGET /api/v1/mortgage-rates/{institutionId}GET /api/v1/mortgage-rates/time-series
Personal Loan RatesGET /api/v1/personal-loan-ratesGET /api/v1/personal-loan-rates/{institutionId}GET /api/v1/personal-loan-rates/time-series
Car Loan RatesGET /api/v1/car-loan-ratesGET /api/v1/car-loan-rates/{institutionId}GET /api/v1/car-loan-rates/time-series
Credit Card RatesGET /api/v1/credit-card-ratesGET /api/v1/credit-card-rates/{issuerId}GET /api/v1/credit-card-rates/time-series

The health endpoint, GET /api/v1/health, shows if the API can read its database. For each dataset, it also shows the time of the last change, the time of the last complete successful collection, and if that complete check is stale. Partial updates do not change the complete-check time.

Filters

ParameterEndpointsResult
termInMonthsAll mortgage endpointsOnly the fixed rates for this term, for example, 12. The response does not contain variable floating rates.
institutionIdThe time series of mortgages, personal loans, and car loansOnly the data of this institution
issuerIdThe time series of credit cardsOnly the data of this issuer

The data contains mortgage terms of 6, 12, 18, 24, 36, 48, and 60 months. If you send a different term, the products arrays are empty.

An endpoint does not use a filter that it does not accept. For example, the credit card time series does not use institutionId, and it gives the data of all issuers. Make sure that you send the correct filter for each endpoint.

Responses

All successful responses are JSON. Each rate response has a lastUpdated field in UTC, ISO 8601 format. A partial update keeps the previous timestamp when stored data exists, because some institutions were not checked successfully. For timestamp differences and retained records, read Data Freshness.

All error responses are JSON, also for a path that does not exist. An error response has this shape:

{
  "code": 400,
  "error": "invalid_request",
  "message": "Invalid request parameters",
  "hint": "Make sure that each parameter has the correct name and format. Dates use the YYYY-MM-DD format. For the parameters of each endpoint, refer to https://www.ratesapi.nz/openapi.json.",
  "documentationUrl": "https://www.ratesapi.nz/docs/api-reference#filters"
}
FieldValue
codeThe HTTP status code
errorA code for the type of error. This code does not change, so you can use it in your code.
messageA message about the error. The text can change.
hintInformation that tells you how to correct the error
documentationUrlThe documentation page for this type of error
HTTP statuserrorCauseExample message
400invalid_requestA parameter is not correct. For example, a date is not in YYYY-MM-DD format.Invalid request parameters
404institution_not_found or issuer_not_foundThe institution or the issuer does not exist.Institution not found
404no_dataThe API has no snapshot for the dates in the request.No data available for date: 2020-01-01
404not_foundNo endpoint has this method and path.No endpoint matches this method and path
500server_errorAn error occurred on the server. Send the request again. If the error continues, examine /api/v1/health.An error occurred while retrieving mortgage rates data

The health endpoint gives a different error response for monitors: status is error, with message and timestamp.

Request IDs

The API adds an x-request-id header to the responses of its endpoints. If you send an x-request-id header, the API returns the same value. If you do not send it, the API makes a new value. Use this value to find a request in the logs.

Some responses do not have this header:

  • A response to a path that does not exist
  • A 400 response for a parameter of the incorrect type, for example, termInMonths=abc
  • The Scalar page at /openapi

Time-Series Rules

ParameterDescription
dateThe date of one snapshot, in YYYY-MM-DD format (UTC)
startDateThe first date of a range, in YYYY-MM-DD format (UTC)
endDateThe last date of a range, in YYYY-MM-DD format (UTC). The range contains this date.

Send date, or send startDate and endDate together. Do not send date with startDate or endDate.

If you send no date, the response contains no snapshots. The availableDates field shows the dates that have a snapshot.

Last updated on

On this page