Skip to main content

Using the Rewards API

The Rewards API queries staking rewards data. By staking on a validator, a user earns rewards while securing the network. Indexing and querying this data is challenging and very time-consuming on your own; the Rewards API is your gateway to succinct rewards data on a daily basis or by epoch.

note

The Rewards API is currently only available for Ethereum (epoch & daily), Polkadot and Solana (epoch only).

The locations of the endpoints for this API are:

  • https://eth-rewards.datahub.figment.io/rewards
  • https://polkadot-rewards.datahub.figment.io/rewards
  • https://solana-rewards.datahub.figment.io/rewards

Authentication

Read about the authentication HERE

Requests

You can send an HTTP GET request to the endpoint to fetch rewards data.

The JSON payload must include the following parameters:

  • network: The network (Ethereum or Solana)
  • chain_id: The chain identifier (mainnet or testnet)
  • accounts: An array containing one or more PoSETH Validator addresses
  • start_time: The start time for collecting rewards data (format is YYYY-MM-DD)
  • end_time: The end time for collecting rewards data (format is YYYY-MM-DD)
  • grouping: Either epoch or daily
Example JSON for a Rewards API query
{
"network": "ethereum",
"chain_id": "mainnet",
"accounts": [
"0x8aa7939a2d3d9f2f88f5b3a61cf603603e7a3c28be36aa7f7312c8d0452e81486fcd24208ae8f6a44701267cf4365942"
],
"start_time": "2022-07-23",
"end_time": "2022-07-26",
"grouping": "epoch"
}
info

If you have selected epoch, make sure that your start_time and end_time align with that epochotherwise you may get an empty response.

If you have selected daily, keep the start_time and end_time reasonably close together (within five days). Large ranges will cause latency in the response.

Example Requests

info

In example requests, the text API-KEY must be replaced with your actual credentials for it to function. Similarly, you would need to replace the value of the constant API_KEY in any code examples.

Example curl request to Rewards API for Ethereum Mainnet
curl -X GET https://eth-rewards.datahub.figment.io/rewards \
-H 'Content-Type: application/json' \
-H 'Authorization: API-KEY' \
-d '{
"network": "ethereum",
"chain_id": "mainnet",
"accounts": [
"0x8aa7939a2d3d9f2f88f5b3a61cf603603e7a3c28be36aa7f7312c8d0452e81486fcd24208ae8f6a44701267cf4365942"
],
"start_time": "2022-07-23",
"end_time": "2022-07-26",
"grouping": "epoch"
}'
Click to view example response
Example Rewards API JSON response
[
{
"accounts": [
"0x93257a7d4f1e6998f019483f149a4dbe3bfc8b89358411be769aeedd943de907f178da1773aea9016d1ac2bdfe3794ba"
],
"chain_id": "mainnet",
"rewards": [
{
"text": "0.00335099 ETH",
"currency": "ETH",
"numeric": 3350990,
"exp": 9
}
],
"network": "ethereum",
"validator": "0x93257a7d4f1e6998f019483f149a4dbe3bfc8b89358411be769aeedd943de907f178da1773aea9016d1ac2bdfe3794ba",
"time": "2022-07-27T00:00:00Z"
}
]

API Reference

View the full Rewards API reference HERE