@allratestoday/hmrc-exchange-rate 1.3.0 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# HM Revenue & Customs Exchange
|
|
1
|
+
# HM Revenue & Customs Exchange Rates API — hmrc-exchange-rate
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@allratestoday/hmrc-exchange-rate)
|
|
4
4
|
[](https://github.com/AllRates-Today/hmrc-exchange-rate/blob/main/LICENSE)
|
|
@@ -16,7 +16,22 @@
|
|
|
16
16
|
- 🔷 **Type-safe** — full TypeScript definitions shipped with the package
|
|
17
17
|
- 🧾 **Compliance-grade metadata** — `rate_type`, publication date, and source disclaimer on every response
|
|
18
18
|
|
|
19
|
-
> **Official rate, not mid-market:** every value here is a number HM Revenue & Customs itself published, fixed once printed and carrying the tax authority's own `rate_date` — what filings and audits require. Need the live
|
|
19
|
+
> **Official rate, not mid-market:** every value here is a number HM Revenue & Customs itself published, fixed once printed and carrying the tax authority's own `rate_date` — what filings and audits require. Need the live mid-market rate for pricing or display instead? Use the [mid-market API](https://allratestoday.com/docs/) or [`@allratestoday/sdk`](https://www.npmjs.com/package/@allratestoday/sdk). The two can diverge by several percent.
|
|
20
|
+
|
|
21
|
+
## ⚡ Try it without a key
|
|
22
|
+
|
|
23
|
+
The latest HM Revenue & Customs table is also served keyless, CORS-open and edge-cached, for evaluation, embeds and AI agents:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
curl "https://allratestoday.com/api/open/central-bank/hmrc?source=GBP&target=USD"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const r = await fetch('https://allratestoday.com/api/open/central-bank/hmrc').then((x) => x.json());
|
|
31
|
+
console.log(r.rate_date, r.rates.length); // the tax authority's latest published table, no key
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The open endpoint serves the *latest* table only and asks for a visible attribution link. The client below uses the keyed API, which adds point-in-time tables, history, and CSV/XML/Excel output.
|
|
20
35
|
|
|
21
36
|
## 🔑 Get your API key
|
|
22
37
|
|
|
@@ -36,7 +51,7 @@ yarn add @allratestoday/hmrc-exchange-rate
|
|
|
36
51
|
pnpm add @allratestoday/hmrc-exchange-rate
|
|
37
52
|
```
|
|
38
53
|
|
|
39
|
-
Scoped mirror of [`hmrc-exchange-rate`](https://www.npmjs.com/package/hmrc-exchange-rate) — same code, same versions.
|
|
54
|
+
Requires Node 18+ (global `fetch`); also runs on Bun, Deno and edge runtimes. Scoped mirror of [`hmrc-exchange-rate`](https://www.npmjs.com/package/hmrc-exchange-rate) — same code, same versions.
|
|
40
55
|
|
|
41
56
|
## 🏁 Quick start
|
|
42
57
|
|
|
@@ -70,14 +85,14 @@ const pair = await getRate('GBP', 'USD', { apiKey: 'art_live_...' });
|
|
|
70
85
|
{
|
|
71
86
|
bank: 'hmrc',
|
|
72
87
|
name: 'HM Revenue & Customs',
|
|
73
|
-
rate_date: '2026-
|
|
88
|
+
rate_date: '2026-10-01', // HM Revenue & Customs's own publication date
|
|
74
89
|
source: 'GBP',
|
|
75
90
|
target: 'USD',
|
|
76
|
-
rate: 1.
|
|
91
|
+
rate: 1.3456,
|
|
77
92
|
rate_type: 'monthly',
|
|
78
93
|
derived: false,
|
|
79
94
|
method: 'published',
|
|
80
|
-
disclaimer: '
|
|
95
|
+
disclaimer: 'Official rates as published by the named central bank. On weekends/holidays the most recent published rate_date is returned.'
|
|
81
96
|
}
|
|
82
97
|
```
|
|
83
98
|
|
|
@@ -98,9 +113,9 @@ console.log(table.rate_date, table.rates.length);
|
|
|
98
113
|
{
|
|
99
114
|
bank: 'hmrc',
|
|
100
115
|
name: 'HM Revenue & Customs',
|
|
101
|
-
rate_date: '2026-
|
|
116
|
+
rate_date: '2026-10-01',
|
|
102
117
|
rates: [
|
|
103
|
-
{ "base": "GBP", "quote": "USD", "type": "monthly", "value": 1.
|
|
118
|
+
{ "base": "GBP", "quote": "USD", "type": "monthly", "value": 1.3456 },
|
|
104
119
|
// … the rest of the published table (141 currencies vs GBP)
|
|
105
120
|
],
|
|
106
121
|
disclaimer: '…'
|
|
@@ -140,7 +155,7 @@ Paid plans. One resolved rate per publication date — ready for charting, reval
|
|
|
140
155
|
import { getHistory } from '@allratestoday/hmrc-exchange-rate';
|
|
141
156
|
|
|
142
157
|
const series = await getHistory(
|
|
143
|
-
{ source: 'GBP', target: 'USD', from: '2026-01-01', to: '2026-
|
|
158
|
+
{ source: 'GBP', target: 'USD', from: '2026-01-01', to: '2026-10-01' },
|
|
144
159
|
{ apiKey: 'art_live_...' }
|
|
145
160
|
);
|
|
146
161
|
```
|
|
@@ -153,11 +168,11 @@ const series = await getHistory(
|
|
|
153
168
|
source: 'GBP',
|
|
154
169
|
target: 'USD',
|
|
155
170
|
from: '2026-01-01',
|
|
156
|
-
to: '2026-
|
|
171
|
+
to: '2026-10-01',
|
|
157
172
|
count: 152,
|
|
158
173
|
rates: [
|
|
159
174
|
// one entry per publication date
|
|
160
|
-
{ date: '2026-
|
|
175
|
+
{ date: '2026-10-01', rate: 1.3456, rate_type: 'monthly', derived: false, method: 'published' },
|
|
161
176
|
// …
|
|
162
177
|
],
|
|
163
178
|
disclaimer: '…'
|
|
@@ -174,6 +189,39 @@ HM Revenue & Customs currently publishes rates covering **141 currencies** again
|
|
|
174
189
|
|
|
175
190
|
🇦🇪 `AED` · 🇦🇱 `ALL` · 🇦🇲 `AMD` · 🇦🇴 `AOA` · 🇦🇷 `ARS` · 🇦🇺 `AUD` · 🇦🇼 `AWG` · 🇦🇿 `AZN` · 🇧🇦 `BAM` · 🇧🇧 `BBD` · 🇧🇩 `BDT` · 🇧🇭 `BHD` · 🇧🇮 `BIF` · 🇧🇲 `BMD` · 🇧🇳 `BND` · 🇧🇴 `BOB` · 🇧🇷 `BRL` · 🇧🇸 `BSD` · 🇧🇹 `BTN` · 🇧🇼 `BWP` · 🇧🇾 `BYN` · 🇧🇿 `BZD` · 🇨🇦 `CAD` · 🇨🇩 `CDF` · 🇨🇭 `CHF` · 🇨🇱 `CLP` · 🇨🇳 `CNY` · 🇨🇴 `COP` · 🇨🇷 `CRC` · 🇨🇺 `CUP` · 🇨🇻 `CVE` · 🇨🇿 `CZK` · 🇩🇯 `DJF` · 🇩🇰 `DKK` · 🇩🇴 `DOP` · 🇩🇿 `DZD` · 🇪🇬 `EGP` · 🇪🇷 `ERN` · 🇪🇹 `ETB` · 🇪🇺 `EUR` · 🇫🇯 `FJD` · 🇬🇪 `GEL` · 🇬🇭 `GHS` · 🇬🇲 `GMD` · 🇬🇳 `GNF` · 🇬🇹 `GTQ` · 🇬🇾 `GYD` · 🇭🇰 `HKD` · 🇭🇳 `HNL` · 🇭🇹 `HTG` · 🇭🇺 `HUF` · 🇮🇩 `IDR` · 🇮🇱 `ILS` · 🇮🇳 `INR` · 🇮🇶 `IQD` · 🇮🇸 `ISK` · 🇯🇲 `JMD` · 🇯🇴 `JOD` · 🇯🇵 `JPY` · 🇰🇪 `KES` · 🇰🇬 `KGS` · 🇰🇭 `KHR` · 🇰🇲 `KMF` · 🇰🇷 `KRW` · 🇰🇼 `KWD` · 🇰🇾 `KYD` · 🇰🇿 `KZT` · 🇱🇦 `LAK` · 🇱🇧 `LBP` · 🇱🇰 `LKR` · 🇱🇷 `LRD` · 🇱🇸 `LSL` · 🇱🇾 `LYD` · 🇲🇦 `MAD` · 🇲🇩 `MDL` · 🇲🇬 `MGA` · 🇲🇰 `MKD` · 🇲🇲 `MMK` · 🇲🇳 `MNT` · 🇲🇴 `MOP` · 🇲🇷 `MRU` · 🇲🇺 `MUR` · 🇲🇻 `MVR` · 🇲🇼 `MWK` · 🇲🇽 `MXN` · 🇲🇾 `MYR` · 🇲🇿 `MZN` · 🇳🇬 `NGN` · 🇳🇮 `NIO` · 🇳🇴 `NOK` · 🇳🇵 `NPR` · 🇳🇿 `NZD` · 🇴🇲 `OMR` · 🇵🇦 `PAB` · 🇵🇪 `PEN` · 🇵🇬 `PGK` · 🇵🇭 `PHP` · 🇵🇰 `PKR` · 🇵🇱 `PLN` · 🇵🇾 `PYG` · 🇶🇦 `QAR` · 🇷🇴 `RON` · 🇷🇸 `RSD` · 🇷🇺 `RUB` · 🇷🇼 `RWF` · 🇸🇦 `SAR` · 🇸🇧 `SBD` · 🇸🇨 `SCR` · 🇸🇩 `SDG` · 🇸🇪 `SEK` · 🇸🇬 `SGD` · 🇸🇱 `SLE` · 🇸🇴 `SOS` · 🇸🇷 `SRD` · 🇸🇻 `SVC` · 🇸🇿 `SZL` · 🇹🇭 `THB` · 🇹🇲 `TMT` · 🇹🇳 `TND` · 🇹🇴 `TOP` · 🇹🇷 `TRY` · 🇹🇹 `TTD` · 🇹🇼 `TWD` · 🇹🇿 `TZS` · 🇺🇦 `UAH` · 🇺🇬 `UGX` · 🇺🇸 `USD` · 🇺🇾 `UYU` · 🇺🇿 `UZS` · 🇻🇪 `VES` · 🇻🇳 `VND` · 🇻🇺 `VUV` · 🇼🇸 `WST` · `XAF` · `XCD` · `XOF` · `XPF` · 🇾🇪 `YER` · 🇿🇦 `ZAR` · 🇿🇲 `ZMW` · 🇿🇼 `ZWG`
|
|
176
191
|
|
|
192
|
+
## 🏛️ Source
|
|
193
|
+
|
|
194
|
+
HM Revenue & Customs is the United Kingdom's tax, payments, and customs authority. It publishes one official exchange rate table per calendar month — released ahead of the month it applies to — and that single rate is what UK customs declarations and VAT invoices must use for the whole month, regardless of how the market moves in between.
|
|
195
|
+
|
|
196
|
+
- Publisher's own page: [Monthly exchange rates for customs and VAT](https://www.trade-tariff.service.gov.uk/exchange_rates) · [www.gov.uk/government/organisations/hm-revenue-customs](https://www.gov.uk/government/organisations/hm-revenue-customs)
|
|
197
|
+
- Publication: every month; the exact schedule, freshness status and any current delay are on the [HM Revenue & Customs rates page](https://allratestoday.com/tax-authority-rates-api/hmrc/)
|
|
198
|
+
- Values are stored unmodified, with the publisher's own `rate_date` on every row — see the [methodology](https://allratestoday.com/official-rates-methodology/)
|
|
199
|
+
|
|
200
|
+
## 🧭 Reading the numbers
|
|
201
|
+
|
|
202
|
+
- `value` is always **quote currency per 1 unit of base currency** (`base: "EUR", quote: "USD", value: 1.15` means 1 EUR = 1.15 USD).
|
|
203
|
+
- HM Revenue & Customs quotes **foreign currency per 1 GBP** (e.g. `base: "GBP", quote: "USD"` means USD per one GBP).
|
|
204
|
+
- Need the other way round? Ask `getRate(target, source)` and the API inverts or crosses for you, flagged `derived: true` — never divide a published rate yourself in a compliance workflow.
|
|
205
|
+
- `rate_type` tells you which of the tax authority's series a row belongs to (`monthly` here); some publishers print buy/sell or several fixings for the same pair.
|
|
206
|
+
|
|
207
|
+
## 🧩 ERP & accounting systems
|
|
208
|
+
|
|
209
|
+
Loading the official HM Revenue & Customs rate into an accounting system is a supported workflow, not a hack. Step-by-step guides with the direction each system expects:
|
|
210
|
+
|
|
211
|
+
- [Dynamics 365 Business Central](https://allratestoday.com/docs/integrations/business-central/) — built-in Currency Exchange Rate Service, no code
|
|
212
|
+
- [Xero](https://allratestoday.com/docs/integrations/xero/) · [QuickBooks Online](https://allratestoday.com/docs/integrations/quickbooks/) · [SAP S/4HANA and ECC](https://allratestoday.com/docs/integrations/sap/) · [Odoo](https://allratestoday.com/docs/integrations/odoo/)
|
|
213
|
+
|
|
214
|
+
The same keyed endpoints return `?format=csv`, `?format=xml` and `?format=xlsx`, and accept the key as `?api_key=` on the URL for importers that cannot send headers:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
curl "https://allratestoday.com/api/v1/central-bank/hmrc/latest?format=xml&api_key=art_live_..."
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## 🤖 AI agents
|
|
221
|
+
|
|
222
|
+
- MCP server: `npx -y @allratestoday/central-bank-mcp` (stdio) or the hosted endpoint `https://allratestoday.com/api/mcp` — tools for official rates, history, cross-bank comparison and publication calendars
|
|
223
|
+
- Machine-readable site guide: [llms.txt](https://allratestoday.com/llms.txt) · [for-ai-agents](https://allratestoday.com/for-ai-agents/)
|
|
224
|
+
|
|
177
225
|
## ⚖️ Published vs derived rates
|
|
178
226
|
|
|
179
227
|
If HM Revenue & Customs does not print a pair directly, the API resolves it from the tax authority's own table and says so — official and computed values are never confused:
|
|
@@ -248,7 +296,8 @@ Need the whole archive rather than an API call? The same published tables are mi
|
|
|
248
296
|
|
|
249
297
|
- [HM Revenue & Customs rates page](https://allratestoday.com/tax-authority-rates-api/hmrc/) — live table, publication cadence, FAQ
|
|
250
298
|
- [All tax authority sources](https://allratestoday.com/tax-authority-rates-api/)
|
|
251
|
-
- [
|
|
299
|
+
- [Package docs on the site](https://allratestoday.com/docs/sdk/hmrc-exchange-rate/) · [ERP integration guides](https://allratestoday.com/docs/integrations/)
|
|
300
|
+
- [API documentation](https://allratestoday.com/docs/#central-bank) · [Interactive reference](https://allratestoday.com/api-reference/) · [Methodology](https://allratestoday.com/official-rates-methodology/)
|
|
252
301
|
- [Register (free)](https://allratestoday.com/register) · [Pricing](https://allratestoday.com/pricing/)
|
|
253
302
|
- [GitHub](https://github.com/AllRates-Today/hmrc-exchange-rate)
|
|
254
303
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allratestoday/hmrc-exchange-rate",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Official HM Revenue & Customs (United Kingdom) monthly exchange rates — 141 currencies vs GBP, history since 2021. Zero-dependency Node.js/TypeScript client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hmrc",
|