@allratestoday/sama-exchange-rate 1.3.0 → 1.3.1
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 +53 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Saudi Central Bank (SAMA) Exchange
|
|
1
|
+
# Saudi Central Bank (SAMA) Exchange Rates API — sama-exchange-rate
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@allratestoday/sama-exchange-rate)
|
|
4
4
|
[](https://github.com/AllRates-Today/sama-exchange-rate/blob/main/LICENSE)
|
|
@@ -18,6 +18,21 @@
|
|
|
18
18
|
|
|
19
19
|
> **Official rate, not mid-market:** every value here is a number Saudi Central Bank (SAMA) itself published, fixed once printed and carrying the central bank's own `rate_date` — what filings and audits require. Need the live interbank midpoint 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
20
|
|
|
21
|
+
## ⚡ Try it without a key
|
|
22
|
+
|
|
23
|
+
The latest Saudi Central Bank (SAMA) 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/sama?source=EUR&target=SAR"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const r = await fetch('https://allratestoday.com/api/open/central-bank/sama').then((x) => x.json());
|
|
31
|
+
console.log(r.rate_date, r.rates.length); // the central bank'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.
|
|
35
|
+
|
|
21
36
|
## 🔑 Get your API key
|
|
22
37
|
|
|
23
38
|
Get a free API key at [allratestoday.com/register](https://allratestoday.com/register) — no credit card required. Latest rates are on every plan, including free.
|
|
@@ -36,7 +51,7 @@ yarn add @allratestoday/sama-exchange-rate
|
|
|
36
51
|
pnpm add @allratestoday/sama-exchange-rate
|
|
37
52
|
```
|
|
38
53
|
|
|
39
|
-
Scoped mirror of [`sama-exchange-rate`](https://www.npmjs.com/package/sama-exchange-rate) — same code, same versions.
|
|
54
|
+
Requires Node 18+ (global `fetch`); also runs on Bun, Deno and edge runtimes. Scoped mirror of [`sama-exchange-rate`](https://www.npmjs.com/package/sama-exchange-rate) — same code, same versions.
|
|
40
55
|
|
|
41
56
|
## 🏁 Quick start
|
|
42
57
|
|
|
@@ -77,7 +92,7 @@ const pair = await getRate('EUR', 'SAR', { apiKey: 'art_live_...' });
|
|
|
77
92
|
rate_type: 'close',
|
|
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
|
|
|
@@ -175,6 +190,39 @@ Saudi Central Bank (SAMA) currently publishes rates covering **12 currencies** a
|
|
|
175
190
|
|
|
176
191
|
🇦🇺 `AUD` · 🇧🇷 `BRL` · 🇨🇭 `CHF` · 🇨🇳 `CNY` · 🇪🇺 `EUR` · 🇬🇧 `GBP` · 🇮🇳 `INR` · 🇯🇵 `JPY` · 🇰🇷 `KRW` · 🇹🇭 `THB` · 🇹🇷 `TRY` · 🇺🇸 `USD`
|
|
177
192
|
|
|
193
|
+
## 🏛️ Source
|
|
194
|
+
|
|
195
|
+
The Saudi Central Bank (SAMA) publishes riyal exchange rates monthly — period averages and end-of-period values for 12 currencies — with the riyal itself pegged to the US dollar at 3.75 since 1986. SAMA offers no machine-readable feed of its own, so this series is sourced from the KAPSARC open-data mirror of SAMA’s table and typically trails the calendar by about two months.
|
|
196
|
+
|
|
197
|
+
- Publisher's own page: [Exchange rates — KAPSARC open-data mirror](https://datasource.kapsarc.org/explore/dataset/exchange-rate/) · [www.sama.gov.sa](https://www.sama.gov.sa)
|
|
198
|
+
- Publication: every month; the exact schedule, freshness status and any current delay are on the [Saudi Central Bank (SAMA) rates page](https://allratestoday.com/central-bank-rates-api/sama/)
|
|
199
|
+
- Values are stored unmodified, with the publisher's own `rate_date` on every row — see the [methodology](https://allratestoday.com/official-rates-methodology/)
|
|
200
|
+
|
|
201
|
+
## 🧭 Reading the numbers
|
|
202
|
+
|
|
203
|
+
- `value` is always **quote currency per 1 unit of base currency** (`base: "EUR", quote: "USD", value: 1.15` means 1 EUR = 1.15 USD).
|
|
204
|
+
- Saudi Central Bank (SAMA) quotes **SAR per 1 unit of foreign currency** (e.g. `base: "USD", quote: "SAR"` means SAR per one US dollar).
|
|
205
|
+
- 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.
|
|
206
|
+
- `rate_type` tells you which of the central bank's series a row belongs to (`close` here); some publishers print buy/sell or several fixings for the same pair.
|
|
207
|
+
|
|
208
|
+
## 🧩 ERP & accounting systems
|
|
209
|
+
|
|
210
|
+
Loading the official Saudi Central Bank (SAMA) rate into an accounting system is a supported workflow, not a hack. Step-by-step guides with the direction each system expects:
|
|
211
|
+
|
|
212
|
+
- [Dynamics 365 Business Central](https://allratestoday.com/docs/integrations/business-central/) — built-in Currency Exchange Rate Service, no code
|
|
213
|
+
- [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/)
|
|
214
|
+
|
|
215
|
+
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:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
curl "https://allratestoday.com/api/v1/central-bank/sama/latest?format=xml&api_key=art_live_..."
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## 🤖 AI agents
|
|
222
|
+
|
|
223
|
+
- 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
|
|
224
|
+
- Machine-readable site guide: [llms.txt](https://allratestoday.com/llms.txt) · [for-ai-agents](https://allratestoday.com/for-ai-agents/)
|
|
225
|
+
|
|
178
226
|
## ⚖️ Published vs derived rates
|
|
179
227
|
|
|
180
228
|
If Saudi Central Bank (SAMA) does not print a pair directly, the API resolves it from the central bank's own table and says so — official and computed values are never confused:
|
|
@@ -249,7 +297,8 @@ Need the whole archive rather than an API call? The same published tables are mi
|
|
|
249
297
|
|
|
250
298
|
- [Saudi Central Bank (SAMA) rates page](https://allratestoday.com/central-bank-rates-api/sama/) — live table, publication cadence, FAQ
|
|
251
299
|
- [All central bank sources](https://allratestoday.com/central-bank-rates-api/)
|
|
252
|
-
- [
|
|
300
|
+
- [Package docs on the site](https://allratestoday.com/docs/sdk/sama-exchange-rate/) · [ERP integration guides](https://allratestoday.com/docs/integrations/)
|
|
301
|
+
- [API documentation](https://allratestoday.com/docs/#central-bank) · [Interactive reference](https://allratestoday.com/api-reference/) · [Methodology](https://allratestoday.com/official-rates-methodology/)
|
|
253
302
|
- [Register (free)](https://allratestoday.com/register) · [Pricing](https://allratestoday.com/pricing/)
|
|
254
303
|
- [GitHub](https://github.com/AllRates-Today/sama-exchange-rate)
|
|
255
304
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allratestoday/sama-exchange-rate",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Official Saudi Central Bank (SAMA) (Saudi Arabia) monthly exchange rates — 12 currencies vs SAR, history since 2009. Zero-dependency Node.js/TypeScript client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sama",
|