API AuthenticationClick to view API Authentication details
API calls require authentication with API key via Authorization request header or URL property. Calls are made to one of the Avalanche Rewards API endpoints found in your app's dashboard.
For example: https://avalanche-rewards.datahub.figment.io
Here's some boilerplate to get you started.
Fetch with Header
Fetch with Parameter
CURL with Header
CURL with Parameter
fetch("https://avalanche-rewards.datahub.figment.io/v2/rewards",{ method:'POST',// can also be 'GET', 'PUT' or any appropriate method headers:{ "Authorization":"<api_key>", "Content-Type":"application/json"// if method is 'POST' }, body:JSON.stringify({ // JSON Payload }) })
fetch("https://avalanche-rewards.datahub.figment.io/apikey/{{apikey}}/v2/rewards",{ method:'POST',// can also be 'GET', 'PUT' or any appropriate method headers:{ "Content-Type":"application/json"// if method is 'POST' }, body:JSON.stringify({ // JSON Payload }) })
start and end are timestamps (in the format YYYY-MM-DD) (required)
Response
The response is broken down between meta and data
meta
network is the name of the network queried
period_unit is the unit of the period field under data: daily here
data is an array of objects - one for each period - containing:
validator returns the validator that distributed the rewards
timestamp is the timestamp of the day's start (midnight UTC)
rewards is an array of objects. The formula to compute the final rewards in the currency unit is numeric x 10^(-exp) (text being the string version of this).
Limitations
This API returns rewards for Figment validators only
Data is available approximately an hour after the end of the day or epoch. When requesting daily for the current day, the data will be available but obviously partially complete as the day progresses.