api/v2/tickers - Litecoin

This endpoint returns current or historical fiat exchange rates for Litecoin. A timestamp or block selects historical rates; without either, the latest available rates are returned.

Parameters

ParameterTypeLocationRequiredDescription
currencystringqueryNoFiat currency code. All available currencies when omitted
timestampintegerqueryNoUnix timestamp for historical rates
blockstringqueryNoBlock height or hash whose timestamp selects the rate

Request

bashcurl --location --request GET 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/tickers/?currency=usd'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/tickers/?currency=usd'
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/tickers/?currency=usd')

print(response.json())

Response

json{
    "ts": 1789701602,
    "rates": {
        "usd": 54.74
    }
}

Response Parameters

FieldTypeDescription
tsintegerTimestamp of the rate actually returned
ratesobjectRates keyed by currency code

ts is the timestamp of the rate actually returned, which can differ from the one requested when no exact match exists. A rate of -1 marks a currency that is unavailable or invalid for that timestamp.

Use Cases

  • Fiat Display: Show an LTC amount in a user's local currency
  • Historical Valuation: Value a past transaction at the rate of its block
  • Invoicing: Convert a fiat-priced invoice into LTC at the current rate

Error Handling

HTTP StatusMessageDescription
400Bad requestA query parameter is malformed
403ForbiddenMissing or invalid ACCESS-TOKEN
500Internal errorThe indexer failed to read rate data