The section provides the examples of how to interact with the API for Ethereum data.
Using curl commands
Request examples are provided using cURL. To demonstrate the API usage scenarios, the examples cover:- retrieving the last staking period,
- fetching active stakes for validators,
- checking validator states,
- obtaining rewards by type.
Get Last Staking Period
To retrieve the last staking period, send a GET request to /api/v1/{network}/data/network/last-staking-period. Example request:period— last staking period.updatedAt— timestamp of the last update to the queue.
Get Delegator Stake
To fetch an active stake for each validator, send a GET request to /api/v1/{network}/data/delegator/stakes. Note that there is a list of additional query params. Example request:-
startNumber— start number of the staking period. -
finishNumber— finish number of the staking period. -
limit— number of resources that a single response page contains. -
address— delegator address in the required network. -
addressType— delegator address type in the required network:deposit— available for the Ethereum network (used by default).withdrawal— available for the Ethereum network.delegator— available for the Polygon, Solana, Cosmos, and Sui networks (used by default).stake_account— available for the Solana.nominator— available for the Polkadot network (used by default).nominator_reward_account— available for the Polkadot network.
-
limit— number of resources that a single response page contains, the default value is 50. -
offset— number of resources to exclude from the beginning of a response. -
list:stakingPeriod— number of the staking period.stakingPeriodStart— timestamp of the staking period start in the ISO 8601 format.stakingPeriodEnd— timestamp of the staking period finish in the ISO 8601 format.stake— total stake balance of the delegator.validator— validator address.
Get Validator State and Statuses
To retrieve validator state, send a GET request to /api/v1/{network}/data/validator/state. Example request:address— validator address in the required network. For the Ethereum network, it is a public validator key.
state— validator state.activatedAt— timestamp of the validator activated date in the ISO 8601 format.activatedStakingPeriodNum— timestamp of the validator activated staking period.
-
total— total count of validators. -
by_status:pending_initialized— number of validators which are initialized but not yet in the queue for activation.pending_queued— number of validators that entered a queue for activation.active_ongoing— number of validators that were activated and currently participate in attesting and proposing blocks.active_slashed— number of validators that were slashed due to misbehaviors.exited_unslashed— number of validators that have exited the network without being slashed and are no longer acting as validators.exited_slashed— number of validators that have exited the network after being slashed and are no longer acting as validators.withdrawal_possible— number of validators having a non-zero balance.withdrawal_done— number of validators completed the withdrawal process.
Get Delegator Rewards
To fetch a list of delegators rewards by type, send a GET request to /api/v1/{network}/data/delegator/rewards. Note that there is a list of additional query params, e.g., grouping the data by date. Example request:-
startAt— timestamp of the report data period start in the ISO 8601 format. If not specified, the default value is the one month ago. -
finishAt— timestamp of the report data period finish in the ISO 8601 format. If not specified, the default value is the current date. -
limit— number of resources that a single response page contains; from 1 to 1000. -
address— delegator address in the required network. -
addressType— delegator address type in the required network:deposit— available for the Ethereum network (used by default).withdrawal— available for the Ethereum network.delegator— available for the Polygon, Solana, Cosmos, and Sui networks (used by default).stake_account— available for the Solana.nominator— available for the Polkadot network (used by default).nominator_reward_account— available for the Polkadot network.
-
validatorAddress— validator address in the required network for this delegator. -
groupBy— group the output data:stakingPeriod— aggregate the results by epoch.day— aggregate the results by days.all— aggregate the results over the entire period.
-
limit— number of resources that a single response page contains. -
offset— number of resources to exclude from the beginning of a response. -
list:-
stakingPeriod— number of the staking period. -
stakingPeriodStart— timestamp of the staking period start in the ISO 8601 format. -
stakingPeriodEnd— timestamp of the staking period finish in the ISO 8601 format. -
rewards:type— rewards type:consensusorexecution.amount— amount of tokens in the stake.currency— currency of the tokens.recipient— rewards recipient address.
-
Using Python code
This section demonstrates how to use Python with the Staking Data API. The examples for Ethereum data cover:- fetching the delegator daily rewards,
- retrieving the summary for a delegator and validator.
Get Delegator Rewards
To fetch the daily rewards for a delegator, use the following code with the API endpoint /api/v1/{network}/data/delegator/rewards:Get Delegator Summary
To fetch the lifetime stake, rewards, and APY for a delegator, use the following code with the API endpoint /api/v1/{network}/data/delegator/summary:-
APY— delegator annual percentage yield (APY). -
Stake— total stake balance of the delegator. -
Rewards:Type— rewards type:consensusorexecution.Amount— amount of tokens in the stake.
Get Validator Summary
To retrieve the validator summary, use the following code with the API endpoint /api/v1/{network}/data/validator/summary:Staking Period— number of the staking period.StartandEnd— timestamp of the staking period start and finish in the ISO 8601 format.APY— validator annual percentage yield (APY).Stake— total stake balance of the validator.Rewards:Amount— amount of tokens in the stake.