Skip to main content

Endpoint

GET /api/rate/{from_currency}/{to_currency}
Retrieves the current exchange rate between two currencies without performing a conversion. You can use this endpoint to check rates before making a conversion.

Path parameters

from_currency
string
required
Source currency code (e.g., USD, EUR, GBP). Must be 3-5 characters in length.
to_currency
string
required
Target currency code (e.g., USD, EUR, GBP). Must be 3-5 characters in length.

Example request

curl -X GET "http://localhost:8000/api/rate/USD/EUR"

Response

from_currency
string
Source currency code
to_currency
string
Target currency code
rate
decimal
Exchange rate used for conversion
timestamp
datetime
When the rate was fetched
source
string
Providers of rates

Example response

{
  "from_currency": "USD",
  "to_currency": "EUR",
  "rate": 0.8550,
  "timestamp": "2025-09-27T10:30:00Z",
  "source": "averaged"
}

Status codes

  • 200 - Successfully retrieved exchange rate
  • 400 - Invalid currency code (currency not supported)
  • 422 - Invalid parameters (e.g., invalid currency format)
  • 500 - Internal server error
  • 503 - Exchange rate service unavailable (all providers failed)

Build docs developers (and LLMs) love