Skip to main content

Rewards API - Polkadot


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 Polkadot Rewards API endpoints found in your app's dashboard.

For example: https://polkadot-rewards.datahub.figment.io

Here's some boilerplate to get you started.
fetch("https://polkadot-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
})
})

Available Methods

Rewards by era

Returns net delegator rewards (post-on-chain validator commission) by epoch

Request Body (try it)
Example Response
{
"data": [
{
"accounts": [
"12m7XtVWZQuxTirqtzm2dm5J4r16vSQruPmahThMnskG8Bcp"
],
"chain_id": "mainnet",
"rewards": [
{
"text": "4.4045175383 DOT",
"currency": "DOT",
"numeric": 44045175383,
"exp": 10
}
],
"period": "845",
"validator": "138QdRbUTB9eNY94Q4Mj5r39FkgMiyHCAy8UFMNA5gvtrfSB",
"timestamp": "2022-09-25T15:36:18Z"
},
{
"accounts": [
"12m7XtVWZQuxTirqtzm2dm5J4r16vSQruPmahThMnskG8Bcp"
],
"chain_id": "mainnet",
"rewards": [
{
"text": "3.6694634053 DOT",
"currency": "DOT",
"numeric": 36694634053,
"exp": 10
}
],
"period": "846",
"validator": "138QdRbUTB9eNY94Q4Mj5r39FkgMiyHCAy8UFMNA5gvtrfSB",
"timestamp": "2022-09-26T15:36:18Z"
}
],
"meta": {
"network": "polkadot",
"period_unit": "era"
}
}
SpecificationView Specification

Body

  • accounts takes in an array of stash accounts addresses (required)
  • start and end are era numbers, both inclusive (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
  • data is an array of objects - one for each era - containing:
    • validator returns the validator that distributed the rewards
    • period is the era number
    • timestamp is the timestamp of the end of the era
    • rewards is an array of objects with four components: numeric, exp, and currency. The formula to compute the final 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.