The instruction how to retrieve currency exchange rates from the NBP website

Instructions for downloading exchange rates from the NBP website in XML format

Instructions for downloading exchange rates from the NBP website in XML format

Information

Please note that as of 25 January 2023, the domain name, path and scheme (HTTPS) for accessing currency exchange rates and gold prices has changed. The URL of the dir.txt file containing the list of XML file names is as follows: https://static.nbp.pl/dane/kursy/xml/dir.txt

Accordingly, the addresses of XML files also has changed and they are as follows:
https://static.nbp.pl/dane/kursy/xml/xnnnzrrmmdd.xml
where the ‘xnnnzrrmmdd’ string of characters will be the corresponding name from a dir.txt file.

Please also note that the current dir.txt file addresses: http://www.nbp.pl/kursy/xml/dir.txt
and XML files with this pattern: http://www.nbp.pl/kursy/xml/xnnnzrrmmdd.xml
in the www.nbp.pl domain as well as the HTTP scheme are no longer maintained as of 1 March 2024.

Retrieving XML files containing NBP exchange rates

XML files containing NBP exchange rates can be found on the NBP website static.nbp.pl in folder:

/dane/kursy/xml/*.xml

In addition, the following file can be found in the same location under:

https://static.nbp.pl/dane/kursy/xml/dir.txt

It contains the names of files (without .xml extension) with tables specifying currency exchange rates. The file contains the current year’s data only. Data for the previous years can be found in dir2002.txt, dir2003.txt … dir 2015.txt files.

The names of all files have the same format, i.e.:

‘xnnnzrrmmdd.xml’

where particular letters denote the following:

x – letter denoting the type of a table:

  • a – table of average foreign currency exchange rates;
  • b – table of average exchange rates of inconvertible currencies;
  • c – table of purchase and sale exchange rates;
  • h – table of exchange rates of units of account.

nnn – 3-character (numerical) number of a table in a year;

z – letter ‘z’ (constant element)

rrmmdd – date of publication/effective date of the table in the following format (no spaces): last two digits of the number of a year, two digits of the number of a month and two digits of the number of a day.

.xml – standard extension of a xml file name.

The example of retrieving from the NBP website of an xml file with table A of average exchange rates published on 5 February 2010:

  1. In the dir.txt file, search is made by dates:
  2. The file being searched is found at:

Present (recent) files with tables A, B and C are also available under the following names: LastA.xml, LastB.xml, LastC.xml. respectively.

Good practice

  • Details of the current exchange rates of foreign currencies in zlotys defined in § 2.3 and § 3 of Resolution No. 51/2002 of the Management Board of Narodowy Bank Polski of 23 September 2002 on the way of calculating and announcing current exchange rates of foreign currencies are available in the following Official Journal of the NBP No. 15/2017 (in Polish).
  • The standard procedure is to download dir.txt file (after the date of its update). In this way, we get the list of all available names of files containing tables of currency exchange rates in a chronological order.
  • The rules for the use of data published on the NBP website can be found in NBP’s Regulations.