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 Solana Rewards API endpoints found in your app's dashboard.
For example: https://solana-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://solana-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://solana-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 }) })
Returns rewards (and balances) for all stake accounts. The response payload is broken down by epoch and by stake account. The net rewards are shown, meaning after the on-chain validator commission has been subtracted.
accounts is an array of stake account addresses (required)
start and end can be either epochs (numbers) or timestamps (strings formatted like "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: here it will be epoch
data is an array of objects - one for each epoch - containing:
validator returns the validator that distributed the rewards
system_account returns the system account that stake account was created from
accounts returns the stake account that received the rewards
period is the epoch number
timestamp is the timestamp at the end of the epoch
rewards is an array of objects containing numeric, exp, currency, and text. The formula to compute the rewards in the currency unit is numeric x 10^(-exp)(text is the string version of this)
balances is an array of objects containing numeric, exp, currency, and text.
Limitations
The 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.
Returns rewards (and balances) for all stake accounts created from the provided system account. The response payload is broken down by epoch and by staking account. The net rewards are shown, meaning after the on-chain validator commission has been subtracted.
addresses is an array of system account addresses (required)
start and end can be either epochs (numbers) or timestamps (strings formatted like "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: here it will be epoch
data is an array of objects - one for each epoch and stake account - containing:
validator returns the validator that distributed the rewards
accounts returns the stake account that received the rewards
system_account returns the system account the stake account was created from
period is the epoch number
timestamp is the timestamp at the end of the epoch
rewards is an array of objects containing numeric, exp, currency, and text. The formula to compute the rewards in the currency unit is numeric x 10^(-exp)(text is the string version of this)
Limitations
The 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.