https://github.com/matchilling/hmrc-exchange-rates
🇬🇧 HMRC Exchange Rates API for Customs & VAT 💸
https://github.com/matchilling/hmrc-exchange-rates
api exchange-rates git-scraping hmrc united-kingdom vat
Last synced: 1 day ago
JSON representation
🇬🇧 HMRC Exchange Rates API for Customs & VAT 💸
- Host: GitHub
- URL: https://github.com/matchilling/hmrc-exchange-rates
- Owner: matchilling
- Created: 2020-03-22T17:07:05.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-30T03:12:22.000Z (11 months ago)
- Last Synced: 2024-10-30T06:15:01.637Z (11 months ago)
- Topics: api, exchange-rates, git-scraping, hmrc, united-kingdom, vat
- Language: Shell
- Homepage: https://hmrc.matchilling.com
- Size: 803 KB
- Stars: 10
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🇬🇧 HMRC Exchange Rates API for Customs & VAT [](https://github.com/matchilling/hmrc-exchange-rates/actions/workflows/update_rates_cron_job.yml)
Find foreign exchange rates issued by [His Majesty's Revenue and Customs][hmrc-url]
in JSON format from __Jan 2015__ till __Oct 2025__.__Last update: Sun Oct 5 03:22:12 UTC 2025__
## Usage
```sh
# 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
- SpainYou 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][hmrc-url] and [XML][hmrc-url] 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](./script/converter/from_csv.sh).
```sh
$ 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
```[hmrc-url]: https://www.trade-tariff.service.gov.uk/exchange_rates