Documentation

Currency Conversion Endpoint

The Currency Conversion endpoint allows you to convert specific amounts between any two supported currencies using real-time exchange rates. This endpoint is perfect for applications that need to perform actual currency conversions, such as e-commerce platforms, financial calculators, or payment processing systems.

Simply specify the amount you want to convert, the source currency, and the target currency, and you'll receive the converted amount along with the exchange rate used for the conversion.

Currency Conversion

GET /api/v1/convert
Available on:
EssentialStartUpProfessional

Request Parameters

key string

Your API key for authentication

amount number

The amount to convert (required)

from string

The source currency code (e.g., USD, EUR, GBP)

to string

The target currency code (e.g., USD, EUR, GBP)

output string

Response output format. Use `json` (default) or `xml`

Default: json

Response Properties

valid boolean

Indicates whether the request was successful

updated integer

The timestamp when the exchange rate was last updated (Unix timestamp)

conversion object

Object containing the conversion details

amount number

The original amount that was converted

from string

The source currency code used for the conversion

to string

The target currency code used for the conversion

result number

The converted amount in the target currency

Understanding Currency Conversion

The conversion process works by taking your specified amount and multiplying it by the current exchange rate between the source and target currencies. Here's how it works:

  • Input: 100 USD to EUR
  • Exchange Rate: 1 USD = 0.85 EUR
  • Calculation: 100 × 0.85 = 85 EUR
  • Output: 85 EUR

The API automatically handles the exchange rate lookup and calculation, so you don't need to worry about fetching rates separately unless you need them for display purposes.

Common Use Cases

The Currency Conversion endpoint is commonly used for:

  • E-commerce platforms: Convert product prices to customer's local currency
  • Financial calculators: Build currency conversion tools and widgets
  • Payment processing: Convert transaction amounts between currencies
  • Travel applications: Show costs in different currencies for trip planning
  • Investment platforms: Convert portfolio values and transaction amounts
  • Multi-currency dashboards: Display converted amounts across different currencies

Best Practices

To optimize your use of the Currency Conversion endpoint:

  • Validate currency codes: Ensure both from and to parameters use valid currency codes
  • Handle decimal amounts: The API supports decimal amounts for precise conversions
  • Cache conversions: For frequently used conversions, consider caching results briefly
  • Error handling: Always check the valid field and handle conversion errors gracefully
  • Rate transparency: Display the exchange rate used for user transparency