# NBU Data API (x402)

> Paid, agent-ready JSON API over the National Bank of Ukraine (NBU) open data: official hryvnia (UAH) exchange rates, rate history, the key policy rate, CPI inflation and OVDP government bond auctions. Pay per call in USDC with the x402 protocol (v2). No account, no API key.

- Network: Base Sepolia (testnet) (eip155:84532)
- Asset: USDC (0x036CbD53842c5426634e7929541eC2318f3dCF7e), scheme `exact`
- Pay to: 0x44e5eBeB366Ab69A0a3C1c05080a01FE0d8013ef
- Calls that fail (4xx/5xx) are never settled, so they cost nothing. Malformed parameters get a free 400 before any 402.
- Responses: `{ data, meta }`; `meta` carries the NBU source URL and attribution.

## Paid endpoints

- [GET /v1/rates](https://nbu-test.navistri.com/v1/rates?date=2026-10-09&currency=USD): $0.001 per call. Official National Bank of Ukraine (NBU) exchange rates of the hryvnia (UAH) on a date: 40+ currencies, gold, silver and SDR, with English names. Call it when you need the legally official UAH rate for Ukrainian accounting, tax, invoices or customs, or to convert to/from UAH on a given date. Params: date (YYYY-MM-DD, default today in Kyiv), currency (ISO code, optional; omit for all).
- [GET /v1/rates/history](https://nbu-test.navistri.com/v1/rates/history?currency=EUR&from=2026-09-01&to=2026-09-30): $0.003 per call. Daily official NBU exchange-rate series of one currency against the hryvnia (UAH) for a period of up to 366 days, plus min, max and % change. Call it to chart or analyse UAH moves, compute averages for Ukrainian reporting, or check a rate across several dates in one paid call. Params: currency (default USD), from and to (YYYY-MM-DD; default the last 31 days).
- [GET /v1/key-rate](https://nbu-test.navistri.com/v1/key-rate?date=2026-10-12): $0.001 per call. National Bank of Ukraine key policy rate (облікова ставка) on a date, with the overnight deposit and overnight loan rates and every policy-rate change in the previous ~13 months. Call it for Ukrainian loan or deposit maths, late-payment penalties tied to the NBU rate, macro briefs, or to see when the rate last moved. Param: date (YYYY-MM-DD, default today in Kyiv).
- [GET /v1/inflation](https://nbu-test.navistri.com/v1/inflation?month=2026-08): $0.002 per call. Ukraine consumer price inflation for a month: headline and core CPI as % month-on-month, year-on-year, since December and period average, from the national total (State Statistics Service data republished by the NBU). Call it to index UAH amounts, write a macro brief, or compare Ukrainian inflation. Param: month (YYYY-MM; omit for the latest published month).
- [GET /v1/ovdp/auctions](https://nbu-test.navistri.com/v1/ovdp/auctions?date=2026-10-06): $0.002 per call. Results of Ukrainian domestic government bond (OVDP) primary auctions held by the Ministry of Finance, as published by the NBU: ISIN, maturity, cut-off and average yield, bid-to-cover, volumes and funds raised. Call it for UAH yield-curve points, sovereign debt monitoring or fixed-income briefs. Param: date (YYYY-MM-DD auction date; omit for the latest auction).

## How to pay (x402 v2)

1. Call the endpoint. You get HTTP 402 with a `PAYMENT-REQUIRED` header: base64 JSON listing scheme, network, asset, amount and payTo.
2. Sign the USDC transfer authorization (EIP-3009) for that amount. Any x402 client does this for you.
3. Retry the same request with the `PAYMENT-SIGNATURE` header. On success you get HTTP 200 and a `PAYMENT-RESPONSE` header with the settlement transaction.

TypeScript example with the official client:

```ts
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

const pay = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:84532", client: new ExactEvmScheme(privateKeyToAccount(KEY)) }],
  spendControls: { maxAmountPerPayment: "$0.01" },
});
const res = await pay("https://nbu-test.navistri.com/v1/rates?currency=USD");
```

## Free endpoints

- [OpenAPI 3.1 description](https://nbu-test.navistri.com/openapi.json): parameters, schemas and examples for every endpoint
- [Health](https://nbu-test.navistri.com/health): service and payment configuration status
- [Home](https://nbu-test.navistri.com/): short human page in English and Ukrainian

## Source and terms

- Data: National Bank of Ukraine open data (bank.gov.ua), https://bank.gov.ua/ua/open-data/api-dev
- Ukrainian public open data: free reuse including commercial use, with mandatory attribution to the source (Law of Ukraine 'On Access to Public Information', art. 10-1; https://bank.gov.ua/ua/open-data). Values are passed through unchanged. Not affiliated with or endorsed by the NBU.
