tostringwymagane
Target currency code (e.g. EUR).
https://api.sandbase.ai/v1/api/x-rates/monthly-averageRetrieves monthly average exchange rates for a specific currency pair for a given year. Returns up to 12 monthly data points with the average rate and number of days in each month. Defaults to the current year if year is not specified.
Twój wynik pojawi się tutaj
Uzupełnij dane wejściowe, a następnie kliknij Uruchom.
Retrieves monthly average exchange rates for a specific currency pair for a given year. Returns up to 12 monthly data points with the average rate and number of days in each month. Defaults to the current year if year is not specified.
curl -X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "x-rates/monthly-average", "to": "JPY", "from": "USD", "year": "2024", "amount": 1.0}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
from | string | Yes | Source currency code (e.g. USD). One of: USD, EUR, GBP, JPY, CHF, CAD, AUD. |
to | string | Yes | Target currency code (e.g. EUR). |
amount | number | No | Amount to calculate rates for. |
year | string | No | Year in YYYY format. Defaults to the current year. |
Flat $0.03 per call. Failed calls are not charged.
Zacznij tworzyć
Punkt końcowy API platformy z jednolitym uwierzytelnianiem i śledzeniem użycia.
curl -X POST "https://api.sandbase.ai/v1/api/x-rates/monthly-average" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "JPY",
"from": "USD",
"year": "2024",
"amount": 1
}'Ustaw klucz API SandBase w środowisku serwera. Żądania używają uwierzytelniania Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Przechowuj klucz na serwerze. Nie ujawniaj go w kodzie przeglądarkowym.
tostringwymaganeTarget currency code (e.g. EUR).
fromstringwymaganeSource currency code (e.g. USD).
Możliwe wartości: USD, EUR, GBP, JPY, CHF, CAD, AUD
yearstringYear in YYYY format. Defaults to the current year.
amountnumberAmount to calculate rates for.
Domyślnie: 1
Zapisany przykładowy response dla tego API; podczas wyświetlania nie jest wykonywane żadne żądanie na żywo.
Nie opublikowano zapisanego response. Uruchom API w Playground, aby sprawdzić jego odpowiedź.
Odkryj więcej
| API | Cena | Odpowiedź |
|---|---|---|
X-Rates Monthly AverageTo API X-Rates | $0.03 za wywołanie | JSON |
X-Rates | $0.03 za wywołanie | JSON |
X-Rates | $0.03 za wywołanie | JSON |
X-Rates | $0.03 za wywołanie | JSON |
X-Rates | $0.03 za wywołanie | JSON |
X-Rates | $0.03 za wywołanie | JSON |
Pytania
Wyślij żądanie POST do https://api.sandbase.ai/v1/api/x-rates/monthly-average z kluczem API SandBase w nagłówku Authorization (Bearer) oraz parametrami w treści JSON. Możesz też wypróbować je w Playground na tej stronie bez pisania kodu.
$0.03 za wywołanie, rozliczane z salda SandBase. Płacisz tylko za wykonane wywołania; nie ma subskrypcji.
Wymagane: to (string) i from (jedna z opcji: USD, EUR, GBP, JPY, CHF, CAD, AUD). Opcjonalne: year (string) i amount (number). Tabela Parameters oraz Playground na tej stronie zawierają wszystkie pola.
Odpowiedź JSON zwrócona w tym samym żądaniu HTTP (synchronicznie).
Nie. X-Rates Monthly Average działa przez SandBase, więc jeden klucz API SandBase obejmuje ten endpoint i każde inne API oraz model w katalogu. Nie musisz osobno ubiegać się o dostęp do API X-Rates.