Best Exchange Rate API for Ruby and Rails in 2026 (with Code Examples)

Reviewed by Madhushan, Fintech Developer — August 2026
Programmer working on a Ruby on Rails application

Ruby on Rails still powers a huge slice of the internet's commerce: marketplaces, subscription platforms, invoicing tools, and the Shopify ecosystem around them. When a Rails app needs currency conversion — showing localized prices, settling multi-currency orders, reporting revenue in a home currency — you want an exchange rate API that feels like Ruby: a clean REST call, predictable JSON, and nothing exotic in between.

Plenty of currency APIs make that harder than it needs to be. Some lock historical data or non-USD bases behind paid plans. Some update once a day, which breaks anything that reprices in near real time. Others cap free usage so low you burn the quota in one afternoon of development.

This article compares the 5 most popular exchange rate APIs for Ruby developers in 2026, with working Net::HTTP code for the winner. AllRatesToday comes out on top with real-time mid-market rates updated every 60 seconds, 160+ currencies, historical data on the free tier, and no credit card required to start.

Side-by-Side Comparison

API Free Tier Historical Data Currencies Update Speed
AllRatesToday Free, no CC Yes, on free tier 160+ 60 seconds
ExchangeRate-API 1,500 req/mo Paid only 160+ Daily
Open Exchange Rates 1,000 req/mo Limited on free 170+ Hourly
Frankfurter Unlimited Yes (ECB only) ~30 Daily (ECB)
Fixer.io 100 req/mo Paid only 170+ Daily

Key takeaway: AllRatesToday is the only API on this list that combines real-time rates updated every 60 seconds, historical data on the free tier, and no credit card requirement — all behind a simple Bearer-token REST API that Ruby's standard library handles perfectly.

1. AllRatesToday — Best Overall for Ruby

AllRatesToday delivers real-time mid-market rates from institutional interbank market data for 160+ currencies. The REST API uses standard Bearer authentication and returns clean JSON, so plain Net::HTTP plus the built-in JSON module is all you need — no gems. Sign up at allratestoday.com/register to get a free key (they look like art_live_...).

Get the latest rates

GET /api/v1/rates returns an array of rate objects — one per target currency:

require "net/http"
require "json"

api_key = ENV.fetch("ALLRATESTODAY_API_KEY")

uri = URI("https://allratestoday.com/api/v1/rates?source=USD&target=EUR,GBP,JPY")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{api_key}"

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(req)
end

raise "API returned #{res.code}" unless res.is_a?(Net::HTTPSuccess)

rates = JSON.parse(res.body)
rates.each do |r|
  puts "1 #{r["source"]} = #{format("%.4f", r["rate"])} #{r["target"]} (as of #{r["time"]})"
end

Convert an amount

Fetch the pair's rate, then multiply with BigDecimal so you never lose precision on money:

require "net/http"
require "json"
require "bigdecimal"
require "bigdecimal/util"

def fetch_rate(api_key, from, to)
  uri = URI("https://allratestoday.com/api/v1/rates?source=#{from}&target=#{to}")
  req = Net::HTTP::Get.new(uri)
  req["Authorization"] = "Bearer #{api_key}"

  res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(req)
  end
  raise "API returned #{res.code}" unless res.is_a?(Net::HTTPSuccess)

  rates = JSON.parse(res.body)
  raise "No rate for #{from}/#{to}" if rates.empty?
  rates.first["rate"].to_d # BigDecimal, not Float
end

rate   = fetch_rate(ENV.fetch("ALLRATESTODAY_API_KEY"), "USD", "EUR")
amount = BigDecimal("1000")

converted = (amount * rate).round(2, :banker)
puts "$1,000.00 = €#{converted.to_s("F")}"

Fetch historical rates

GET /api/historical-rates returns a series of daily data points for a pair over a preset period (1d, 7d, 30d, or 1y):

uri = URI("https://allratestoday.com/api/historical-rates?source=USD&target=EUR&period=30d")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{api_key}"

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(req)
end

history = JSON.parse(res.body)
history["data"].each do |point|
  puts "#{point["date"]}: #{format("%.4f", point["rate"])}"
end

Docs: Full endpoint reference, parameters, and response schemas are on the AllRatesToday developer page.

2. ExchangeRate-API

ExchangeRate-API offers a straightforward REST interface and a relatively generous free tier of 1,500 requests per month. However, rates update only once a day and historical data requires a paid plan, which rules it out for anything approaching real-time pricing.

3. Open Exchange Rates

Open Exchange Rates has been around since 2012 and is reliable, but the free plan locks the base currency to USD and updates only hourly. If your Rails app needs EUR- or GBP-based rates, you either pay or invert USD pairs yourself.

4. Frankfurter

Frankfurter is a free, open-source API serving European Central Bank reference rates. No API key is needed, which makes it a favorite default for the money and eu_central_bank gem ecosystem and for tests. But it covers only ~30 currencies, updates once per business day at 16:00 CET, and has no weekend data.

5. Fixer.io

Fixer was once the default choice (the popular money gem ecosystem had first-class support for it) but has stagnated since its acquisition by APILayer. The free tier is severely limited: 100 requests per month, EUR-only base, and HTTP only (no HTTPS) — a non-starter for production Rails apps handling financial data.

Best Practices: Money and Caching in Ruby

Never use Float for money

Binary floating point cannot represent values like 0.1 exactly, and errors compound across arithmetic. Convert API rates to BigDecimal at the boundary ("1.0842".to_d or rate.to_d), do all arithmetic in BigDecimal, and round exactly once at the end. In Rails apps, the money-rails gem stores amounts as integer cents, which pairs naturally with a BigDecimal exchange rate.

Cache rates with Rails.cache

Rates update every 60 seconds at most, so there is no reason to hit the API on every request. A short TTL in Rails.cache cuts your request volume dramatically:

class ExchangeRateService
  CACHE_TTL = 5.minutes

  def rate(from, to)
    Rails.cache.fetch("fx/#{from}/#{to}", expires_in: CACHE_TTL) do
      fetch_rate(from, to) # the Net::HTTP call from above
    end
  end
end

A 5-minute TTL is a sensible default for most applications. See our full guide on caching exchange rates to avoid rate limits for stampede protection and Redis-backed variants.

Frequently Asked Questions

What is the best exchange rate API for Ruby on Rails?

AllRatesToday is the best exchange rate API for Ruby and Rails in 2026. Its clean REST API works with the standard Net::HTTP library, delivers real-time mid-market rates for 160+ currencies updated every 60 seconds, and has a free tier with no credit card required.

How do I get exchange rates in Ruby?

Use Ruby's standard Net::HTTP library to call GET https://allratestoday.com/api/v1/rates?source=USD&target=EUR with an Authorization: Bearer header, then parse the JSON response with the built-in JSON module. No gems are required.

Is there a free currency API I can use with Ruby?

Yes. AllRatesToday offers a free tier with no credit card required, covering real-time rates, currency conversion, and historical data. Frankfurter is also free but only covers about 30 ECB currencies with daily updates.

Should I use Float for currency amounts in Ruby?

No. Binary floating point cannot represent decimal amounts exactly, which causes rounding errors in money calculations. Use BigDecimal from Ruby's standard library (or the money gem in Rails apps) for amounts, and keep Float only for display or non-critical analytics.

How often does AllRatesToday update its exchange rates?

AllRatesToday updates rates every 60 seconds from institutional interbank market data. Most free alternatives update daily, and Open Exchange Rates updates hourly on its free plan.

Start Building with Ruby and Real-Time Rates

Get your free API key in 30 seconds and fetch real-time mid-market rates for 160+ currencies with nothing but Net::HTTP. Paid plans start at €4.99/month — see pricing for details.

Get Your Free API Key

Related Articles