staking delegations - Cosmos
Example code for the staking delegations REST method. Complete guide on how to use the staking delegations REST method in GetBlock Web3 documentation.
Returns all delegations made by a delegator, paginated.
Endpoint
GET /cosmos/staking/v1beta1/delegations/{delegator_addr}Path Parameters
delegator_addr
string
Bech32 delegator address (cosmos1...)
Query Parameters
pagination.limit
string
Max results per page
Example
export COSMOS_REST=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/
curl "${COSMOS_REST}cosmos/staking/v1beta1/delegations/cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5"Response
{
"delegation_responses": [
{
"delegation": {
"delegator_address": "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5",
"validator_address": "cosmosvaloper1xv9tklw7d82sezh9haa573wufgy59vmwnp5s7g",
"shares": "1000000.000000000000000000"
},
"balance": {
"denom": "uatom",
"amount": "1000000"
}
}
],
"pagination": {
"total": "1"
}
}Response Fields
delegation_responses
array
The delegator's delegations, each with shares and balance
delegation_responses[].balance
object
The delegated amount in uatom
Use Cases
Portfolio: Show a user's staked positions across validators
Error Handling
400 / Bad request
Bad request
A path, query, or body parameter was invalid
404 / Not found
Not found
The account, validator, proposal, or resource does not exist
403 / RBAC: access denied
Access denied
The GetBlock access token is missing or incorrect
Was this helpful?