Skip to content

Crypto Rates

Returns live exchange rates from a chosen fiat currency to all supported cryptocurrencies. Each value tells you how many units of that coin equal 1 unit of the base currency.

For example, with currency=USD:

  • "BTC": 0.0000140 → 1 USD = 0.0000140 BTC
  • "ETH": 0.000458 → 1 USD = 0.000458 ETH
  • "DOGE": 10.93 → 1 USD = 10.93 DOGE

Use this to:

  • Build a currency converter (e.g. "how many SOL is $500?")
  • Display live crypto prices derived from a fiat base
  • Power a portfolio value calculator in the user's local currency
  • Feed a rate comparison table across hundreds of coins

Base URL

https://crypto-news51.p.rapidapi.com

Get crypto rates

GET/api/v1/convert-rates/crypto/from

Returns a single JSON object with from (the base currency code) and to (a map of coin → rate).

Authentication

HeaderValue
X-RapidAPI-KeyYour RapidAPI secret key
X-RapidAPI-Hostcrypto-news51.p.rapidapi.com

Query parameters

ParameterTypeDefaultDescription
currencystringrequired
ISO 4217 fiat currency code to use as the base (e.g. USD, EUR, GBP). See Fiat Supported for the full list of 152 accepted codes.
detailedbooleantrue Controls the key format in the to object.

false — keys are ticker symbols only: "BTC": 0.000014
true  — keys include full name and type: "BTC:BITCOIN:CRYPTO": 0.000014

Which detailed value to use?

Use detailed=false when you only need rates for lookups by ticker symbol — the response is smaller and faster to parse.

Use detailed=true when you need the full coin name alongside the rate (e.g. to display "Bitcoin" in a UI), so you avoid a separate lookup.


Example requests

bash
curl "https://crypto-news51.p.rapidapi.com/api/v1/convert-rates/crypto/from?currency=USD&detailed=false" \
  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: crypto-news51.p.rapidapi.com"
bash
curl "https://crypto-news51.p.rapidapi.com/api/v1/convert-rates/crypto/from?currency=EUR&detailed=true" \
  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: crypto-news51.p.rapidapi.com"
javascript
const params = new URLSearchParams({ currency: 'USD', detailed: 'false' })

const response = await fetch(
  `https://crypto-news51.p.rapidapi.com/api/v1/convert-rates/crypto/from?${params}`,
  {
    headers: {
      'X-RapidAPI-Key': process.env.RAPIDAPI_KEY,
      'X-RapidAPI-Host': 'crypto-news51.p.rapidapi.com',
    },
  }
)

const data = await response.json()
// data.from  → "USD"
// data.to    → { BTC: 0.0000140, ETH: 0.000458, ... }

// Convert $500 to BTC
const usdAmount = 500
const btcAmount = usdAmount * data.to['BTC']
console.log(`$${usdAmount} = ${btcAmount.toFixed(8)} BTC`)
javascript
const params = new URLSearchParams({ currency: 'USD', detailed: 'true' })

const response = await fetch(
  `https://crypto-news51.p.rapidapi.com/api/v1/convert-rates/crypto/from?${params}`,
  {
    headers: {
      'X-RapidAPI-Key': process.env.RAPIDAPI_KEY,
      'X-RapidAPI-Host': 'crypto-news51.p.rapidapi.com',
    },
  }
)

const { from, to } = await response.json()

// Parse "SYMBOL:FULL NAME:CRYPTO" keys into a structured list
const coins = Object.entries(to).map(([key, rate]) => {
  const [symbol, name] = key.split(':')
  return { symbol, name, rate }
})

// Display top 5 by rate (most units per 1 USD = cheapest coin)
const top5 = coins.sort((a, b) => b.rate - a.rate).slice(0, 5)
for (const coin of top5) {
  console.log(`1 ${from} = ${coin.rate.toLocaleString()} ${coin.symbol} (${coin.name})`)
}
python
import os
import requests

response = requests.get(
    "https://crypto-news51.p.rapidapi.com/api/v1/convert-rates/crypto/from",
    params={"currency": "USD", "detailed": "false"},
    headers={
        "X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"],
        "X-RapidAPI-Host": "crypto-news51.p.rapidapi.com",
    },
)

response.raise_for_status()
data = response.json()

base = data["from"]
rates = data["to"]

print(f"Base: {base}  |  {len(rates)} coins\n")

# Convert a specific amount
amount = 500
for symbol in ["BTC", "ETH", "SOL", "XRP", "DOGE"]:
    if symbol in rates:
        converted = amount * rates[symbol]
        print(f"  {amount} {base} = {converted:,.6f} {symbol}")
python
import os
import requests

response = requests.get(
    "https://crypto-news51.p.rapidapi.com/api/v1/convert-rates/crypto/from",
    params={"currency": "USD", "detailed": "true"},
    headers={
        "X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"],
        "X-RapidAPI-Host": "crypto-news51.p.rapidapi.com",
    },
)

response.raise_for_status()
data = response.json()

# Parse "SYMBOL:FULL NAME:CRYPTO" keys
coins = []
for key, rate in data["to"].items():
    parts = key.split(":")
    symbol, name = parts[0], parts[1] if len(parts) > 1 else ""
    coins.append({"symbol": symbol, "name": name.title(), "rate": rate})

# Show a few well-known coins
targets = {"BTC", "ETH", "SOL", "BNB", "XRP", "ADA", "DOGE"}
print(f"{'Symbol':<8}  {'Name':<30}  {'Rate (per 1 USD)':>20}")
print("-" * 62)
for coin in coins:
    if coin["symbol"] in targets:
        print(f"{coin['symbol']:<8}  {coin['name']:<30}  {coin['rate']:>20,.8f}")

Response — detailed=false

Keys in to are plain ticker symbols.

json
{
  "from": "USD",
  "to": {
    "BTC": 0.000014083553945986279,
    "ETH": 0.000458165054819814,
    "BNB": 0.0016659844620408363,
    "SOL": 0.01216759406738337,
    "XRP": 0.7499680022363626,
    "ADA": 4.00838728884627,
    "DOGE": 10.935161386692322,
    "SHIB": 170374.82639114853,
    "PEPE": 287509.2536711103,
    "BONK": 174540.28355504203
  }
}

Response — detailed=true

Keys in to follow the format SYMBOL:FULL NAME:CRYPTO.

json
{
  "from": "USD",
  "to": {
    "BTC:BITCOIN:CRYPTO": 0.000014083553945986279,
    "ETH:ETHEREUM:CRYPTO": 0.000458165054819814,
    "BNB:BNB:CRYPTO": 0.0016659844620408363,
    "SOL:SOL (WORMHOLE):CRYPTO": 0.01216759406738337,
    "XRP:BINANCE-PEG XRP TOKEN:CRYPTO": 0.7499680022363626,
    "ADA:CARDANO:CRYPTO": 4.00838728884627,
    "DOGE:DEPARTMENT OF GOV EFFICIENCY:CRYPTO": 10.935161386692322,
    "SHIB:SHIBA INU:CRYPTO": 170374.82639114853
  }
}

Response fields

FieldTypeDescription
fromstringThe base fiat currency code echoed from the request (e.g. USD).
toobject Map of coin identifier → rate. Each rate is the number of coin units equal to 1 unit of from.

Key format depends on detailed:
false: "BTC"
true: "BTC:BITCOIN:CRYPTO"

Parsing detailed keys

When detailed=true, split each key on : to extract the parts:

"BTC:BITCOIN:CRYPTO"
  ↑       ↑      ↑
symbol  name   type (always "CRYPTO")
javascript
const [symbol, name, type] = key.split(':')
// symbol → "BTC"
// name   → "BITCOIN"
// type   → "CRYPTO"
python
symbol, name, *rest = key.split(':')
# symbol → "BTC"
# name   → "BITCOIN"

Converting amounts

To convert from the base fiat to crypto, multiply the amount by the rate:

cryptoAmount = fiatAmount × rate

To convert from crypto back to fiat, divide:

fiatAmount = cryptoAmount / rate
javascript
const rates = data.to  // detailed=false

// $1,000 → BTC
const btc = 1000 * rates['BTC']
console.log(`$1,000 = ${btc.toFixed(8)} BTC`)

// 0.5 ETH → USD
const usd = 0.5 / rates['ETH']
console.log(`0.5 ETH = $${usd.toFixed(2)}`)
python
rates = data["to"]  # detailed=false

# $1,000 → BTC
btc = 1000 * rates["BTC"]
print(f"$1,000 = {btc:.8f} BTC")

# 0.5 ETH → USD
usd = 0.5 / rates["ETH"]
print(f"0.5 ETH = ${usd:.2f}")

Error responses

StatusCodeDescription
400bad_requestcurrency is missing or not a supported fiat code
401unauthorizedX-RapidAPI-Key is missing or invalid
403forbiddenYour RapidAPI plan does not include access to this endpoint
429too_many_requestsRapidAPI rate limit exceeded
500internal_errorServer error — safe to retry after a short delay

EndpointDescription
Fiat SupportedFull list of supported base fiat currency codes
Coins Price ListRanked coin prices with market cap and 24h change

Released under the MIT License.