api/v2/tickers - Zcash

This endpoint returns current or historical fiat exchange rates for Zcash. 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": 1789744501,
    "rates": {
        "usd": 1478.55
    }
}

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. A rate of -1 marks a currency that is unavailable for that timestamp.

Use Cases

  • Fiat Display: Show a ZEC 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 ZEC at the current rate

Error Handling

HTTP StatusMessageDescription
400Bad requestA path or query parameter is malformed
403ForbiddenMissing or invalid ACCESS-TOKEN
404Not foundNo indexed data exists for the request
500Internal errorThe indexer failed to process the request