tostringobrigatório
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.
Sua saída aparecerá aqui
Preencha as entradas e clique em Executar.
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.
Comece a construir
Endpoint da API da plataforma com autenticação unificada e rastreamento de uso.
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
}'Defina sua chave da API SandBase no ambiente do seu servidor. As requisições usam autenticação Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Mantenha sua chave no servidor. Não a exponha em código do navegador.
tostringobrigatórioTarget currency code (e.g. EUR).
fromstringobrigatórioSource currency code (e.g. USD).
Valores possíveis: USD, EUR, GBP, JPY, CHF, CAD, AUD
yearstringYear in YYYY format. Defaults to the current year.
amountnumberAmount to calculate rates for.
Padrão: 1
Resposta de exemplo salva para esta API; nenhuma requisição ao vivo é feita ao visualizá-la.
Nenhuma resposta salva foi publicada. Execute a API no Playground para inspecionar a resposta.
Explorar mais
| API | Preço | Resposta |
|---|---|---|
X-Rates Monthly AverageEsta API X-Rates | $0.03 por chamada | JSON |
X-Rates | $0.03 por chamada | JSON |
X-Rates | $0.03 por chamada | JSON |
X-Rates | $0.03 por chamada | JSON |
X-Rates | $0.03 por chamada | JSON |
X-Rates | $0.03 por chamada | JSON |
Perguntas
Envie uma solicitação POST para https://api.sandbase.ai/v1/api/x-rates/monthly-average com sua chave de API da SandBase no cabeçalho Authorization (Bearer) e os parâmetros no corpo JSON. Você também pode testar no Playground desta página sem escrever código.
$0.03 por chamada, cobrado do seu saldo SandBase. Você paga apenas pelas chamadas que fizer; não há assinatura.
Obrigatórios: to (string) e from (um de USD, EUR, GBP, JPY, CHF, CAD, AUD). Opcionais: year (string) e amount (number). A tabela de Parâmetros e o Playground nesta página listam todos os campos.
Uma resposta JSON retornada na mesma solicitação HTTP (síncrona).
Não. X-Rates Monthly Average funciona via SandBase, então uma única chave de API da SandBase cobre este endpoint e todas as outras APIs e modelos do catálogo. Você não precisa solicitar acesso à API do X-Rates separadamente.