Download OpenAPI specification:Download
This section provides an overview of the API design, methods, and supported use cases.
Most of the endpoints accept JSON
as input and return JSON
responses.
This means that you must usually add the following headers to your request:
Content-type: application/json
Accept: application/json
You can use a third party client, such as curl, HTTPie, Postman or the Insomnia rest client to test the Staking rewards API.
Note that you will need to pass credentials data.
For e.g., here is how to get blockchains list with curl, when basic authorization is used:
curl -X GET 'https://staking-data-api-p2p.hasura.app/api/rest/blockchains' \
-H 'Content-Type: application/json' \
-H 'x-hasura-admin-secret: secret' \
We follow the error response format proposed in RFC 7807 also known as Problem Details for HTTP APIs. As with our normal API responses, your client must be prepared to gracefully handle additional members of the response.
This means that the server encountered an unexpected condition that prevented it from fulfilling the request.
Method returns the list of blockchains that are supported by API.
You can use this info for API endpoints which consist of blockchain_name
in parameters.
Success.
Request not authenticated due to missing, invalid, authentication info.
A specified resource is not found.
Unknown server error.
{- "blockchains": [
- [
- {
- "blockchain_name": "Ethereum",
- "ecosystem_name": "Ethereum ecosystem"
}, - {
- "blockchain_name": "Polkadot",
- "ecosystem_name": "Polkadot ecosystem"
}, - {
- "blockchain_name": "Kusama",
- "ecosystem_name": "Polkadot ecosystem"
}
]
]
}
This method returns the acceptable periods of blockchain_period
for staking data.
You can use this info for API endpoints which consist of blockchain_period_name
in parameters.
Success.
Request not authenticated due to missing, invalid, authentication info.
A specified resource is not found.
Unknown server error.
{- "blockchainPeriods": [
- {
- "blockchain_name": "Polkadot",
- "ecosystem_name": "Polkadot ecosystem",
- "blockchain_period_name": "era"
}
]
}
This method returns the blockchain staking data for every defined blockchain period
(specified period of rewards payment and stat collection, can be block
era
epoch
day
depends on chain)
Success.
Request not authenticated due to missing, invalid, authentication info.
A specified resource is not found.
Unknown server error.
{- "blockchainReports": [
- {
- "blockchain_name": "Polkadot",
- "ecosystem_name": "Polkadot ecosystem",
- "blockchain_period_name": "era",
- "blockchain_period_num": "946",
- "datetime_from": "2023-01-04 15:36:18.014000",
- "datetime_to": "2023-01-05 15:36:18.011000",
- "blockchain_total_rewards": "241225.0405479788",
- "reward_coingecoid": "polkadot",
- "blockchain_total_stake": "504346062.64968455",
- "stake_coingecoide": "polkadot",
- "delegators_num": "20241",
- "validators_num": "297"
}
]
}
Get the list of active validators per period.
Success.
Request not authenticated due to missing, invalid, authentication info.
A specified resource is not found.
Unknown server error.
{- "validators": [
- {
- "blockchain_name": "Polkadot",
- "ecosystem_name": "Polkadot ecosystem",
- "blockchain_period_name": "era",
- "blockchain_period_num": "946",
- "datetime_from": "2023-01-04 15:36:18.014000",
- "datetime_to": "2023-01-05 15:36:18.011000",
- "validators_addresses": [
- {
- "validator_address": "12eZSMk8GJYE2Lq943dSEnMUoZs1ek7jU8QN3rEA1yPZPjcR"
}, - {
- "validator_address": "12pgR5dyEkUP6iTR9u7b74Nz7uCsCYKpkFfA5LFbQPjGwNHL"
}
]
}
]
}
This method returns the blockchain staking data for every defined blockchain period per every validator that was active.
Success.
Request not authenticated due to missing, invalid, authentication info.
A specified resource is not found.
Unknown server error.
{- "validatorReports": [
- {
- "blockchain_name": "Polkadot",
- "ecosystem_name": "Polkadot ecosystem",
- "blockchain_period_name": "era",
- "blockchain_period_num": "946",
- "datetime_from": "2023-01-04 15:36:18.014000",
- "datetime_to": "2023-01-05 15:36:18.011000",
- "validators_addresses": "14AkAFBzukRhAFh1wyko1ZoNWnUyq7bY1XbjeTeCHimCzPU1",
- "delegator_num": "256",
- "validator_fee": "2.5",
- "stake": [
- {
- "type": "clients_stake",
- "amount": "2275343.5417242087",
- "coingekoid": "polkadot"
}, - {
- "type": "self",
- "amount": "0",
- "coingekoid": "polkadot"
}
], - "rewards": [
- {
- "type": "validator_fee",
- "amount": "20.26669878544223",
- "coingekoid": "polkadot",
- "period_payment_date": "2023-01-05 15:36:18.011000"
}
]
}
]
}
Get the list of active delegators per period.
Success.
Request not authenticated due to missing, invalid, authentication info.
A specified resource is not found.
Unknown server error.
{- "delegators": [
- {
- "blockchain_name": "Polkadot",
- "ecosystem_name": "Polkadot ecosystem",
- "blockchain_period_name": "era",
- "blockchain_period_num": "1016",
- "datetime_from": "2023-03-14 15:36:18.014000",
- "datetime_to": "2023-03-15 15:36:18.011000",
- "blockchain_user_address": [
- {
- "blockchain_user_address": "1BEV8SuBhtFYcXhwesJf9cePgpFjGzY58ybnb4yfrEAaBMx"
}, - {
- "blockchain_user_address": "1MUoG2n9WhmXUszhuQdyPeXSGg7MoVn8ZFaZnXyGyzs4wW1"
}
]
}
]
}
Get delegator on-chain report.
Success.
Request not authenticated due to missing, invalid, authentication info.
A specified resource is not found.
Unknown server error.
{- "delegatorReports": [
- {
- "blockchain_name": "Polkadot",
- "ecosystem_name": "Polkadot ecosystem",
- "blockchain_period_name": "era",
- "blockchain_period_num": "946",
- "datetime_from": "2023-01-04 15:36:18.014000",
- "datetime_to": "2023-01-05 15:36:18.011000",
- "blockchain_user_address": "13YoPoKBvLrZM1avJBUMQ9Ccd8uC7D4y8dWNYeeXqpQQGEYP",
- "stake": [
- {
- "type": "clients_stake",
- "amount": "701.5",
- "coingekoid": "polkadot"
}
], - "rewards": [
- {
- "type": "client_reward",
- "amount": "0.34437678615378675",
- "coingekoid": "polkadot",
- "period_payment_date": "2023-01-05 15:36:18.011000",
- "validator_address": "153YD8ZHD9dRh82U419bSCB5SzWhbdAFzjj4NtA5pMazR2yC"
}
]
}
]
}
Get APR for given deposit address.
Success.
Request not authenticated due to missing, invalid, authentication info.
A specified resource is not found.
Unknown server error.
{- "result": [
- {
- "apr": "4.7415101558088555"
}
]
}
Get total rewards for given deposit address.
Success.
Request not authenticated due to missing, invalid, authentication info.
A specified resource is not found.
Unknown server error.
{- "result": [
- {
- "total_rewards": "0.06417987100000008"
}
]
}