@allratestoday/sdk 1.4.7 → 1.4.9
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 +14 -10
- package/dist/index.d.mts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +9 -6
- package/dist/index.mjs +9 -6
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -95,6 +95,8 @@ console.log(data);
|
|
|
95
95
|
|
|
96
96
|
### Historical Exchange Rates
|
|
97
97
|
|
|
98
|
+
> Historical methods (`forDate`, `timeSeries`, `getHistoricalRates` and `convert` with a `date`) need a paid plan from €4.99/month. Free and trial keys get latest rates only and receive a 403 `historical_requires_paid_plan` for history.
|
|
99
|
+
|
|
98
100
|
Travel back in time to get rates from any date:
|
|
99
101
|
|
|
100
102
|
```typescript
|
|
@@ -121,7 +123,7 @@ console.log(data);
|
|
|
121
123
|
|
|
122
124
|
### Currency Conversion
|
|
123
125
|
|
|
124
|
-
Convert any amount between currencies — including historical conversions:
|
|
126
|
+
Convert any amount between currencies — including historical conversions (paid plans):
|
|
125
127
|
|
|
126
128
|
```typescript
|
|
127
129
|
// Current conversion
|
|
@@ -197,7 +199,7 @@ console.log(data);
|
|
|
197
199
|
|
|
198
200
|
### Time Series Data
|
|
199
201
|
|
|
200
|
-
Get exchange rates over a date range for trend analysis and charting:
|
|
202
|
+
Get exchange rates over a date range for trend analysis and charting (paid plans):
|
|
201
203
|
|
|
202
204
|
```typescript
|
|
203
205
|
const data = await client.timeSeries('2026-01-01', '2026-03-31', {
|
|
@@ -282,13 +284,13 @@ console.log(sources.map((s) => `${s.code} ${s.latest}${s.stale ? ' (stale)' : ''
|
|
|
282
284
|
```
|
|
283
285
|
|
|
284
286
|
Always cite the returned `rate_date` — it is the institution's publication date,
|
|
285
|
-
not the time of your call. Dated tables
|
|
286
|
-
|
|
287
|
+
not the time of your call. Dated tables and history need a paid plan and use
|
|
288
|
+
`/api/v1/central-bank/{bank}/{date}`; publication calendars work on any key. See the
|
|
287
289
|
[central bank rates API](https://allratestoday.com/central-bank-rates-api/).
|
|
288
290
|
|
|
289
291
|
### Historical Rates by Period
|
|
290
292
|
|
|
291
|
-
Get historical rates using preset periods — no date math needed:
|
|
293
|
+
Get historical rates using preset periods — no date math needed (paid plans):
|
|
292
294
|
|
|
293
295
|
```typescript
|
|
294
296
|
const history = await client.getHistoricalRates('USD', 'EUR', '30d');
|
|
@@ -467,6 +469,8 @@ console.log(await getPrice(99.99, 'GBP')); // "78.90 GBP"
|
|
|
467
469
|
|
|
468
470
|
### Historical Chart Data
|
|
469
471
|
|
|
472
|
+
Needs a paid plan (history is not included in free or trial keys).
|
|
473
|
+
|
|
470
474
|
```typescript
|
|
471
475
|
import AllRatesToday from '@allratestoday/sdk';
|
|
472
476
|
|
|
@@ -492,13 +496,13 @@ console.log({ labels, values });
|
|
|
492
496
|
| Method | Description |
|
|
493
497
|
| ------ | ----------- |
|
|
494
498
|
| `latest(options?)` | Get latest rates for one or more currencies |
|
|
495
|
-
| `forDate(date, options?)` | Get rates for a specific historical date |
|
|
496
|
-
| `convert(from, to, amount, options?)` | Convert amount between currencies (
|
|
497
|
-
| `timeSeries(start, end, options?)` | Get rates across a custom date range |
|
|
499
|
+
| `forDate(date, options?)` | Get rates for a specific historical date (paid plan) |
|
|
500
|
+
| `convert(from, to, amount, options?)` | Convert amount between currencies (historical `date` needs a paid plan) |
|
|
501
|
+
| `timeSeries(start, end, options?)` | Get rates across a custom date range (paid plan) |
|
|
498
502
|
| `symbols(options?)` | List all 160+ supported currency codes and names |
|
|
499
503
|
| `getRate(from, to, amount?, options?)` | Get a single exchange rate |
|
|
500
504
|
| `getRates(source, target, options?)` | Get rates with full metadata |
|
|
501
|
-
| `getHistoricalRates(source, target, period?, options?)` | Historical rates by preset period (1d/7d/30d/1y) |
|
|
505
|
+
| `getHistoricalRates(source, target, period?, options?)` | Historical rates by preset period (1d/7d/30d/1y; paid plan) |
|
|
502
506
|
| `officialRates(bank, options?)` | Latest official table (or one pair) published by a central bank / tax authority — **keyless** |
|
|
503
507
|
| `officialSources(options?)` | Every covered official source with latest publication date and freshness — **keyless** |
|
|
504
508
|
|
|
@@ -533,7 +537,7 @@ The same rates are available to coding agents and LLM tools without a second int
|
|
|
533
537
|
- **Claude Code plugin** (no key): `/plugin marketplace add AllRates-Today/claude-code-plugin` then `/plugin install allratestoday@allratestoday`
|
|
534
538
|
- **Hosted MCP endpoint**: `https://allratestoday.com/api/mcp` — Streamable HTTP, keyless, nothing to install
|
|
535
539
|
- **Local MCP servers**: `npx -y @allratestoday/mcp-server` (live mid-market rates) · `npx -y @allratestoday/central-bank-mcp` (official central-bank rates)
|
|
536
|
-
- **Trial key for agents, no signup**: `POST https://allratestoday.com/api/agent/keys` (send `Content-Type: application/json`) returns a 100-call key valid 7 days
|
|
540
|
+
- **Trial key for agents, no signup**: `POST https://allratestoday.com/api/agent/keys` (send `Content-Type: application/json`) returns a 100-call key valid 7 days for latest rates and latest central-bank tables (history and dated tables are paid-plan only); both MCP servers expose it as `request_trial_key`
|
|
537
541
|
- **Daily Reference Rate** (first published 2026-10-12): one fixed USD table per business day, the 16:00 London median of minute samples, never revised — keyless at `https://allratestoday.com/api/open/reference-rate`, `get_reference_rate` in the MCP server
|
|
538
542
|
- Machine-readable site guide: [llms.txt](https://allratestoday.com/llms.txt)
|
|
539
543
|
|
package/dist/index.d.mts
CHANGED
|
@@ -188,7 +188,8 @@ declare class AllRatesToday {
|
|
|
188
188
|
*/
|
|
189
189
|
latest(options?: LatestOptions): Promise<LatestResponse>;
|
|
190
190
|
/**
|
|
191
|
-
* Get exchange rates for a specific historical date.
|
|
191
|
+
* Get exchange rates for a specific historical date. Paid plans only: free and trial keys
|
|
192
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
192
193
|
*
|
|
193
194
|
* ```ts
|
|
194
195
|
* // Using a string
|
|
@@ -203,7 +204,8 @@ declare class AllRatesToday {
|
|
|
203
204
|
*/
|
|
204
205
|
forDate(date: string | Date, options?: ForDateOptions): Promise<ForDateResponse>;
|
|
205
206
|
/**
|
|
206
|
-
* Get exchange rate time series between two dates.
|
|
207
|
+
* Get exchange rate time series between two dates. Paid plans only: free and trial keys
|
|
208
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
207
209
|
*
|
|
208
210
|
* ```ts
|
|
209
211
|
* const data = await client.timeSeries('2026-01-01', '2026-03-31', {
|
|
@@ -245,7 +247,7 @@ declare class AllRatesToday {
|
|
|
245
247
|
* console.log(`ECB ${usd.rate_date}: 1 EUR = ${usd.rate} USD`);
|
|
246
248
|
* ```
|
|
247
249
|
*
|
|
248
|
-
* Dated tables and history need a
|
|
250
|
+
* Dated tables and history need a paid plan: see `/api/v1/central-bank/{bank}/{date}`.
|
|
249
251
|
*/
|
|
250
252
|
officialRates(bank: string, options?: OfficialRateOptions): Promise<OfficialRatesResponse>;
|
|
251
253
|
/**
|
|
@@ -281,7 +283,8 @@ declare class AllRatesToday {
|
|
|
281
283
|
*/
|
|
282
284
|
getRates(source: string, target: string, options?: RequestOptions): Promise<AuthRateResponse[]>;
|
|
283
285
|
/**
|
|
284
|
-
* Get historical rates by period.
|
|
286
|
+
* Get historical rates by period. Paid plans only: free and trial keys
|
|
287
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
285
288
|
*
|
|
286
289
|
* ```ts
|
|
287
290
|
* const history = await client.getHistoricalRates('USD', 'EUR', '30d');
|
|
@@ -299,7 +302,7 @@ declare class AllRatesToday {
|
|
|
299
302
|
* const result = await client.convert('USD', 'EUR', 1000);
|
|
300
303
|
* console.log(`$1,000 = €${result.result}`);
|
|
301
304
|
*
|
|
302
|
-
* // Historical conversion
|
|
305
|
+
* // Historical conversion (paid plans only)
|
|
303
306
|
* const result = await client.convert('USD', 'EUR', 1000, { date: '2026-01-15' });
|
|
304
307
|
* console.log(`Rate on Jan 15: ${result.rate}`);
|
|
305
308
|
* ```
|
package/dist/index.d.ts
CHANGED
|
@@ -188,7 +188,8 @@ declare class AllRatesToday {
|
|
|
188
188
|
*/
|
|
189
189
|
latest(options?: LatestOptions): Promise<LatestResponse>;
|
|
190
190
|
/**
|
|
191
|
-
* Get exchange rates for a specific historical date.
|
|
191
|
+
* Get exchange rates for a specific historical date. Paid plans only: free and trial keys
|
|
192
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
192
193
|
*
|
|
193
194
|
* ```ts
|
|
194
195
|
* // Using a string
|
|
@@ -203,7 +204,8 @@ declare class AllRatesToday {
|
|
|
203
204
|
*/
|
|
204
205
|
forDate(date: string | Date, options?: ForDateOptions): Promise<ForDateResponse>;
|
|
205
206
|
/**
|
|
206
|
-
* Get exchange rate time series between two dates.
|
|
207
|
+
* Get exchange rate time series between two dates. Paid plans only: free and trial keys
|
|
208
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
207
209
|
*
|
|
208
210
|
* ```ts
|
|
209
211
|
* const data = await client.timeSeries('2026-01-01', '2026-03-31', {
|
|
@@ -245,7 +247,7 @@ declare class AllRatesToday {
|
|
|
245
247
|
* console.log(`ECB ${usd.rate_date}: 1 EUR = ${usd.rate} USD`);
|
|
246
248
|
* ```
|
|
247
249
|
*
|
|
248
|
-
* Dated tables and history need a
|
|
250
|
+
* Dated tables and history need a paid plan: see `/api/v1/central-bank/{bank}/{date}`.
|
|
249
251
|
*/
|
|
250
252
|
officialRates(bank: string, options?: OfficialRateOptions): Promise<OfficialRatesResponse>;
|
|
251
253
|
/**
|
|
@@ -281,7 +283,8 @@ declare class AllRatesToday {
|
|
|
281
283
|
*/
|
|
282
284
|
getRates(source: string, target: string, options?: RequestOptions): Promise<AuthRateResponse[]>;
|
|
283
285
|
/**
|
|
284
|
-
* Get historical rates by period.
|
|
286
|
+
* Get historical rates by period. Paid plans only: free and trial keys
|
|
287
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
285
288
|
*
|
|
286
289
|
* ```ts
|
|
287
290
|
* const history = await client.getHistoricalRates('USD', 'EUR', '30d');
|
|
@@ -299,7 +302,7 @@ declare class AllRatesToday {
|
|
|
299
302
|
* const result = await client.convert('USD', 'EUR', 1000);
|
|
300
303
|
* console.log(`$1,000 = €${result.result}`);
|
|
301
304
|
*
|
|
302
|
-
* // Historical conversion
|
|
305
|
+
* // Historical conversion (paid plans only)
|
|
303
306
|
* const result = await client.convert('USD', 'EUR', 1000, { date: '2026-01-15' });
|
|
304
307
|
* console.log(`Rate on Jan 15: ${result.rate}`);
|
|
305
308
|
* ```
|
package/dist/index.js
CHANGED
|
@@ -165,7 +165,8 @@ var AllRatesToday = class {
|
|
|
165
165
|
return { base: params.source, date, rates };
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
|
-
* Get exchange rates for a specific historical date.
|
|
168
|
+
* Get exchange rates for a specific historical date. Paid plans only: free and trial keys
|
|
169
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
169
170
|
*
|
|
170
171
|
* ```ts
|
|
171
172
|
* // Using a string
|
|
@@ -190,7 +191,8 @@ var AllRatesToday = class {
|
|
|
190
191
|
return { base: source, date: dateStr, rates };
|
|
191
192
|
}
|
|
192
193
|
/**
|
|
193
|
-
* Get exchange rate time series between two dates.
|
|
194
|
+
* Get exchange rate time series between two dates. Paid plans only: free and trial keys
|
|
195
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
194
196
|
*
|
|
195
197
|
* ```ts
|
|
196
198
|
* const data = await client.timeSeries('2026-01-01', '2026-03-31', {
|
|
@@ -254,7 +256,7 @@ var AllRatesToday = class {
|
|
|
254
256
|
* console.log(`ECB ${usd.rate_date}: 1 EUR = ${usd.rate} USD`);
|
|
255
257
|
* ```
|
|
256
258
|
*
|
|
257
|
-
* Dated tables and history need a
|
|
259
|
+
* Dated tables and history need a paid plan: see `/api/v1/central-bank/{bank}/{date}`.
|
|
258
260
|
*/
|
|
259
261
|
async officialRates(bank, options = {}) {
|
|
260
262
|
const code = bank.trim().toLowerCase();
|
|
@@ -311,7 +313,7 @@ var AllRatesToday = class {
|
|
|
311
313
|
from: { currency: r.source, amount: 1 },
|
|
312
314
|
to: { currency: r.target, amount: r.rate },
|
|
313
315
|
rate: r.rate,
|
|
314
|
-
source: "
|
|
316
|
+
source: "mid-market"
|
|
315
317
|
};
|
|
316
318
|
}
|
|
317
319
|
return raw;
|
|
@@ -329,7 +331,8 @@ var AllRatesToday = class {
|
|
|
329
331
|
return this.request("/api/v1/rates", { source, target }, key);
|
|
330
332
|
}
|
|
331
333
|
/**
|
|
332
|
-
* Get historical rates by period.
|
|
334
|
+
* Get historical rates by period. Paid plans only: free and trial keys
|
|
335
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
333
336
|
*
|
|
334
337
|
* ```ts
|
|
335
338
|
* const history = await client.getHistoricalRates('USD', 'EUR', '30d');
|
|
@@ -358,7 +361,7 @@ var AllRatesToday = class {
|
|
|
358
361
|
* const result = await client.convert('USD', 'EUR', 1000);
|
|
359
362
|
* console.log(`$1,000 = €${result.result}`);
|
|
360
363
|
*
|
|
361
|
-
* // Historical conversion
|
|
364
|
+
* // Historical conversion (paid plans only)
|
|
362
365
|
* const result = await client.convert('USD', 'EUR', 1000, { date: '2026-01-15' });
|
|
363
366
|
* console.log(`Rate on Jan 15: ${result.rate}`);
|
|
364
367
|
* ```
|
package/dist/index.mjs
CHANGED
|
@@ -139,7 +139,8 @@ var AllRatesToday = class {
|
|
|
139
139
|
return { base: params.source, date, rates };
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
|
-
* Get exchange rates for a specific historical date.
|
|
142
|
+
* Get exchange rates for a specific historical date. Paid plans only: free and trial keys
|
|
143
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
143
144
|
*
|
|
144
145
|
* ```ts
|
|
145
146
|
* // Using a string
|
|
@@ -164,7 +165,8 @@ var AllRatesToday = class {
|
|
|
164
165
|
return { base: source, date: dateStr, rates };
|
|
165
166
|
}
|
|
166
167
|
/**
|
|
167
|
-
* Get exchange rate time series between two dates.
|
|
168
|
+
* Get exchange rate time series between two dates. Paid plans only: free and trial keys
|
|
169
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
168
170
|
*
|
|
169
171
|
* ```ts
|
|
170
172
|
* const data = await client.timeSeries('2026-01-01', '2026-03-31', {
|
|
@@ -228,7 +230,7 @@ var AllRatesToday = class {
|
|
|
228
230
|
* console.log(`ECB ${usd.rate_date}: 1 EUR = ${usd.rate} USD`);
|
|
229
231
|
* ```
|
|
230
232
|
*
|
|
231
|
-
* Dated tables and history need a
|
|
233
|
+
* Dated tables and history need a paid plan: see `/api/v1/central-bank/{bank}/{date}`.
|
|
232
234
|
*/
|
|
233
235
|
async officialRates(bank, options = {}) {
|
|
234
236
|
const code = bank.trim().toLowerCase();
|
|
@@ -285,7 +287,7 @@ var AllRatesToday = class {
|
|
|
285
287
|
from: { currency: r.source, amount: 1 },
|
|
286
288
|
to: { currency: r.target, amount: r.rate },
|
|
287
289
|
rate: r.rate,
|
|
288
|
-
source: "
|
|
290
|
+
source: "mid-market"
|
|
289
291
|
};
|
|
290
292
|
}
|
|
291
293
|
return raw;
|
|
@@ -303,7 +305,8 @@ var AllRatesToday = class {
|
|
|
303
305
|
return this.request("/api/v1/rates", { source, target }, key);
|
|
304
306
|
}
|
|
305
307
|
/**
|
|
306
|
-
* Get historical rates by period.
|
|
308
|
+
* Get historical rates by period. Paid plans only: free and trial keys
|
|
309
|
+
* get a 403 `historical_requires_paid_plan` error.
|
|
307
310
|
*
|
|
308
311
|
* ```ts
|
|
309
312
|
* const history = await client.getHistoricalRates('USD', 'EUR', '30d');
|
|
@@ -332,7 +335,7 @@ var AllRatesToday = class {
|
|
|
332
335
|
* const result = await client.convert('USD', 'EUR', 1000);
|
|
333
336
|
* console.log(`$1,000 = €${result.result}`);
|
|
334
337
|
*
|
|
335
|
-
* // Historical conversion
|
|
338
|
+
* // Historical conversion (paid plans only)
|
|
336
339
|
* const result = await client.convert('USD', 'EUR', 1000, { date: '2026-01-15' });
|
|
337
340
|
* console.log(`Rate on Jan 15: ${result.rate}`);
|
|
338
341
|
* ```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allratestoday/sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "Exchange Rate API — Real-time mid-market currency exchange rates for Node.js and browsers. 160+ currencies, zero dependencies, free tier.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"fx",
|
|
34
34
|
"exchangerate",
|
|
35
35
|
"exchange rate",
|
|
36
|
+
"exchange rates",
|
|
36
37
|
"currency-api",
|
|
37
38
|
"currency-exchange-rates",
|
|
38
39
|
"forex-api",
|