Skip to content

matchilling/hmrc-exchange-rates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‡¬πŸ‡§ HMRC Exchange Rates API for Customs & VAT Update Rates Cron Job

Find foreign exchange rates issued by His Majesty's Revenue and Customs in JSON format from Jan 2015 till Nov 2024.

Last update: Sat Nov 9 03:08:47 UTC 2024

Usage

# Get the latest rates
$ curl -X GET https://hmrc.matchilling.com/rate/latest.json
{
  "base": "GBP",
  "period": {
    "start": "2020-01-01",
    "end": "2020-01-31"
  },
  "rates": {
    "AED": "4.8012",
    "ALL": "143.53",
    "AMD": "624.19",
    "AOA": "598.72",
    "ARS": "78.18",
    "AUD": "1.905",
    ...
  }
}

# Get rates by month (e.g. March 2020)
$ curl -X GET https://hmrc.matchilling.com/rate/2020/03.json

πŸ’· Details

You should use these exchanges rates if you have to convert any foreign currency to sterling for customs and VAT purposes.

The EU rate includes the following countries:

  • Austria
  • Belgium
  • Cyprus
  • Estonia
  • Finland
  • France
  • Germany
  • Greece
  • Ireland
  • Italy
  • Latvia
  • Lithuania
  • Luxembourg
  • Malta
  • Netherlands
  • Portugal
  • Slovakia
  • Slovenia
  • Spain

You should only use the EU rate for conversion of invoices drawn in the euro. Do not confuse it with the euro rate published for agricultural levy purposes or the bit error rate (BER) daily rate set to help payment of taxes in the euro.

πŸ›  CSV and XML converter

HMRC publishes new monthly exchange rates in CSV and XML format on its website during the last week of the month. The CSV version is usually a few days before the XML one available.

Unfortunately only the XML version can be retrieved programmatically as the URI to CSV contains a unique file descriptor which obviously can not be predicted. Therefore the XML converter is being used by default.

However, you can always manually add new rates to this repository using this CSV converter.

$ curl --silent https://www.trade-tariff.service.gov.uk/api/v2/exchange_rates/files/monthly_csv_2023-11.csv | \
    ./script/converter/from_csv.sh \
    > rate/2023/11.json