> ## Documentation Index
> Fetch the complete documentation index at: https://docs.p2p.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Claim Rewards

> Claim accrued TRON voting rewards with the P2P.org Staking API.

TRON pays voting rewards to accounts that vote for Super Representatives. Rewards accrue over maintenance periods and can be claimed once every 24 hours.

To claim accrued voting rewards via the Staking API:

1. Create a claim rewards request.
2. Sign and send the transaction to the network.

> [!NOTE]
>
> Claiming rewards is not the same as [withdrawal](https://docs.p2p.org/docs/withdrawal-tron.md). `/staking/withdraw` returns unfrozen TRX after the unfreezing period, while `/staking/claim-rewards` collects voting rewards.

**1. Create claim rewards request**

To claim the rewards, send a POST request to [/api/v1/tron/\{network}/staking/claim-rewards](https://docs.p2p.org/reference/tron-staking-claim-rewards.md).

Example request (for `testnet-nile` network):

```bash curl theme={null}
curl --request POST \
  --url 'https://api-test.p2p.org/api/v1/tron/testnet-nile/staking/claim-rewards' \
  --header 'accept: application/json' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "delegatorAddress": "TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg3r"
}'
```

```typescript TypeScript theme={null}
const response = await fetch("https://api-test.p2p.org/api/v1/tron/testnet-nile/staking/claim-rewards", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "delegatorAddress": "TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg3r"
  }),
});
const data = await response.json();
console.log(data);
```

```python Python theme={null}
import requests

response = requests.post(
    "https://api-test.p2p.org/api/v1/tron/testnet-nile/staking/claim-rewards",
    headers={
        "Authorization": "Bearer <token>",
        "Content-Type": "application/json",
    },
    json={
        "delegatorAddress": "TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg3r"
    },
)
print(response.json())
```

```go Go theme={null}
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	payload := map[string]interface{}{
		"delegatorAddress": "TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg3r",
	}
	body, _ := json.Marshal(payload)
	req, _ := http.NewRequest("POST", "https://api-test.p2p.org/api/v1/tron/testnet-nile/staking/claim-rewards", bytes.NewBuffer(body))
	req.Header.Set("Authorization", "Bearer <token>")
	req.Header.Set("Content-Type", "application/json")
	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
	respBody, _ := io.ReadAll(resp.Body)
	fmt.Println(string(respBody))
}
```

* `delegatorAddress` — delegator account address to claim accrued voting rewards for.

Example response:

```json theme={null}
{
    "error": null,
    "result": {
      "delegatorAddress": "TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg3r",
      "rewardAmount": "1250000",
      "unsignedTransaction": {
        "visible": false,
        "txID": "...",
        "raw_data_hex": "...",
        "raw_data": {
          "contract": [
            {
              "parameter": {
                "value": {
                  "owner_address": "41866d72460954b4d42d18e63880d26673e6b708f4"
                },
                "type_url": "type.googleapis.com/protocol.WithdrawBalanceContract"
              },
              "type": "WithdrawBalanceContract"
            }
          ],
          "ref_block_bytes": "...",
          "ref_block_hash": "...",
          "expiration": 1750000200000,
          "timestamp": 1750000140000
        }
      },
      "unsignedTransactionSerialized": "eyJ0eElEIjoidHJ4SWQifQ==",
      "createdAt": "2025-06-03T12:00:00.000Z"
    }
  }
```

* `delegatorAddress` — delegator account address that claims the rewards.

* `rewardAmount` — amount of accrued voting rewards to be claimed in SUN (1 TRX = 10⁶ SUN), as an integer string. Reflects the claimable rewards at transaction creation time.

* `unsignedTransaction` — original unsigned transaction object returned by tronWeb.

  * `visible` — internal SDK parameter; always set to `false`.

  * `txID` — hash of the transaction.

  * `raw_data_hex` — raw payload of the unsigned transaction in the hexadecimal format.

  * `raw_data` — full decoded transaction structure with all the fields and metadata:

    * `contract` — list of TRON contracts:

      * `parameter.value.owner_address` — TRON account address in the hexadecimal format.
      * `parameter.type_url` — TRON protocol contract, `type.googleapis.com/protocol.WithdrawBalanceContract`.
      * `type` — TRON protocol contract type.

    * `ref_block_bytes`, `ref_block_hash` — hash and references of the block in which the transaction has been included.

    * `expiration` — timestamp of the transaction expiration in ms since last epoch.

    * `timestamp` — timestamp of the transaction in ms since last epoch.

* `unsignedTransactionSerialized` — unsigned serialized transaction in Base64 encrypted format ready for signing.

* `createdAt` — timestamp of the transaction in the ISO 8601 format.

**2. Sign and send transaction**

Use `unsignedTransactionSerialized` to [sign and send](https://docs.p2p.org/docs/signing-transaction-tron.md) the signed transaction to the TRON network.

After the transaction is confirmed, the claimed rewards are added to the account's available balance. You can verify the claim by several options:

* Get the delegator account summary via [/api/v1/tron/\{network}/account/\{address}](https://docs.p2p.org/reference/tron-account-get.md).
* Check the transaction status via [/api/v1/tron/\{network}/transaction/\{transactionHash}/status](https://docs.p2p.org/reference/tron-transaction-status.md) endpoint.
* View your account on Tronscan: [Mainnet](https://tronscan.org/) or [Nile testnet](https://nile.tronscan.org/).

## Error codes

`/staking/claim-rewards` can return the following `400 Bad request` errors in addition to the standard `401` and `429` responses.

| Code | Exception | Description |
| - | - | - |
| 100101 | `ValidationException` | The data provided is not valid. Please check the request parameters and try again. |
| 125130 | `NoClaimableRewardsException` | No voting rewards available to claim. Rewards accrue to accounts that vote for Super Representatives. |
| 125131 | `RewardsClaimTooEarlyException` | Voting rewards can be claimed only once every 24 hours. The error message includes the time when the next claim becomes available. |
| 125103 | `GetAccountFailedException` | Delegator account is not activated or does not exist on-chain. Please fund the account before proceeding. |
| 125129 | `ClaimRewardsTransactionException` | Failed to create claim rewards transaction. Please verify the account and try again. |


## Related topics

- [Sign and Send Transaction](https://docs.p2p.org/docs/signing-transaction-tron.md)
- [Staking API reference](https://docs.p2p.org/reference/tron-staking-claim-rewards.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.