{
"openapi": "3.1.1",
"info": {
"title": "NBP API",
"description": "NBP (Narodowy Bank Polski) currency exchange API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.nbp.pl/api"
}
],
"components": {
"schemas": {
"TableType": {
"type": "string",
"enum": ["A", "B", "C"]
},
"ExchangeRate": {
"type": "object",
"properties": {
"currency": {
"type": "string"
},
"code": {
"type": "string"
},
"bid": {
"type": "number"
},
"ask": {
"type": "number"
},
"mid": {
"type": "number"
}
},
"required": ["currency", "code"]
},
"CurrencyExchangeTable": {
"type": "object",
"properties": {
"table": {
"$ref": "#/components/schemas/TableType"
},
"no": {
"type": "string",
"description": "Table number"
},
"tradingDate": {
"type": "string"
},
"effectiveDate": {
"type": "string",
"description": "Date representing when the currency exchange was published."
},
"rates": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ExchangeRate"
}
}
},
"required": ["table", "no", "rates"]
},
"GoldPrice": {
"type": "object",
"properties": {
"data": {
"type": "string",
"description": "Date representing when the gold price was published."
},
"cena": {
"type": "number",
"description": "The price of 1g of gold (of 1000 millesimal fineness) calculated at NBP."
}
},
"required": ["data", "cena"]
}
}
},
"paths": {
"/exchangerates/tables/{table}/": {
"summary": "Current table of currency conversion rates",
"get": {
"parameters": [
{
"name": "table",
"in": "path",
"description": "The table type to query. There are types A, B and C",
"required": true,
"schema": {
"$ref": "#/components/schemas/TableType"
}
}
],
"responses": {
"200": {
"description": "Current currency conversion rates",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CurrencyExchangeTable"
}
}
}
}
}
}
}
},
"/exchangerates/tables/{table}/today": {
"summary": "Today's table of currency conversion rates",
"get": {
"parameters": [
{
"name": "table",
"in": "path",
"description": "The table type to query. There are types A, B and C",
"required": true,
"schema": {
"$ref": "#/components/schemas/TableType"
}
}
],
"responses": {
"200": {
"description": "Today's currency conversion rates",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CurrencyExchangeTable"
}
}
}
}
}
}
}
},
"/exchangerates/tables/{table}/{date}/": {
"summary": "Currency conversion rates for a given date",
"get": {
"parameters": [
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"$ref": "#/components/schemas/TableType"
}
},
{
"name": "date",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Currency conversion rates",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CurrencyExchangeTable"
}
}
}
}
}
}
}
},
"/exchangerates/rates/{table}/{code}/last/{topCount}/": {
"summary": "Last `topCount` rates from the requested table and code",
"get": {
"parameters": [
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"$ref": "#/components/schemas/TableType"
}
},
{
"name": "code",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "topCount",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Last `topCount` rates from the requested table and code",
"content": {
"application/json": {
"schema": {
"type": "object",
"items": {
"$ref": "#/components/schemas/ExchangeRate"
}
}
}
}
}
}
}
},
"/exchangerates/rates/{table}/{code}/": {
"summary": "Currency conversion rates for a specific currency",
"get": {
"parameters": [
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"$ref": "#/components/schemas/TableType"
}
},
{
"name": "code",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Currency conversion rates for a specific currency",
"content": {
"application/json": {
"schema": {
"type": "object",
"items": {
"$ref": "#/components/schemas/CurrencyExchangeTable"
}
}
}
}
}
}
}
},
"/exchangerates/rates/{table}/{code}/today/": {
"summary": "Today's currency conversion rate for a given table and code",
"get": {
"parameters": [
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"$ref": "#/components/schemas/TableType"
}
},
{
"name": "code",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Current currency conversion rates",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExchangeRate"
}
}
}
},
"404": {
"description": "Lack of data (currency conversion rate has not been published today)"
}
}
}
},
"/exchangerates/rates/{table}/{code}/{date}/": {
"summary": "Currency conversion rate for a given date",
"get": {
"parameters": [
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"$ref": "#/components/schemas/TableType"
}
},
{
"name": "code",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "date",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Currency conversion rate",
"content": {
"application/json": {
"schema": {
"type": "object",
"items": {
"$ref": "#/components/schemas/ExchangeRate"
}
}
}
}
}
}
}
},
"/exchangerates/rates/{table}/{code}/{startDate}/{endDate}/": {
"summary": "Currency conversion rates for a given date range",
"get": {
"parameters": [
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"$ref": "#/components/schemas/TableType"
}
},
{
"name": "code",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "startDate",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "endDate",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Currency conversion rates",
"content": {
"application/json": {
"schema": {
"type": "object",
"items": {
"$ref": "#/components/schemas/ExchangeRate"
}
}
}
}
}
}
}
},
"/exchangerates/tables/{table}/last/{topCount}/": {
"summary": "Last `topCount` rates from the requested table",
"get": {
"parameters": [
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"$ref": "#/components/schemas/TableType"
}
},
{
"name": "topCount",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Currency conversion rates",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CurrencyExchangeTable"
}
}
}
}
}
}
}
},
"/exchangerates/tables/{table}/{startDate}/{endDate}/": {
"summary": "Currency conversion rates for a given table and date range",
"get": {
"parameters": [
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"$ref": "#/components/schemas/TableType"
}
},
{
"name": "startDate",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "endDate",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Currency conversion rates",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CurrencyExchangeTable"
}
}
}
}
}
}
}
},
"/cenyzlota": {
"get": {
"responses": {
"200": {
"description": "Current gold price",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GoldPrice"
}
}
}
}
}
}
}
},
"/cenyzlota/today": {
"get": {
"responses": {
"200": {
"description": "Current gold price",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GoldPrice"
}
}
}
}
},
"404": {
"description": "Lack of data (gold price has not been published today)"
}
}
}
},
"/cenyzlota/{date}/": {
"get": {
"parameters": [
{
"name": "date",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Gold price for a given date",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GoldPrice"
}
}
}
}
}
}
}
},
"/cenyzlota/{startDate}/{endDate}/": {
"summary": "Gold price for a given date range",
"get": {
"parameters": [
{
"name": "startDate",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "endDate",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Gold price for a given date range",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GoldPrice"
}
}
}
}
}
}
}
},
"/cenyzlota/last/{topCount}": {
"get": {
"parameters": [
{
"name": "topCount",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Last `topCount` gold prices",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GoldPrice"
}
}
}
}
}
}
}
}
},
"externalDocs": {
"url": "https://api.nbp.pl",
"description": "Official, human-readable API documentation."
}
}