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

# Claim Rewards

> Claim accumulated staking rewards

## Overview

Generates transaction calls to claim accrued staking rewards from a pool. Rewards can be claimed anytime with no minimum threshold.

## Path Parameters

<ParamField path="poolAddress" type="string" required>
  Pool contract address
</ParamField>

<ParamField path="userAddress" type="string" required>
  User's wallet address
</ParamField>

## Request

<ParamField body="userAddress" type="string" required>
  User's wallet address
</ParamField>

<ParamField body="restake" type="boolean" required>
  If true, rewards are automatically restaked
</ParamField>

## Response

<ResponseField name="chainId" type="string" required>
  Network identifier
</ResponseField>

<ResponseField name="calls" type="array" required>
  Transaction calls to execute
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://starknet.api.avnu.fi/staking/v3/pools/0x123abc/members/0x0456def/claim-rewards" \
    -H "Content-Type: application/json" \
    -d '{
      "userAddress": "0x0456def...",
      "restake": false
    }'
  ```

  ```typescript TypeScript theme={null}
  async function claimRewards(
    poolAddress: string,
    account: Account,
    restake: boolean = false
  ) {
    const response = await fetch(
      `https://starknet.api.avnu.fi/staking/v3/pools/${poolAddress}/members/${account.address}/claim-rewards`,
      {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({
          userAddress: account.address,
          restake
        })
      }
    );

    const { calls } = await response.json();
    const tx = await account.execute(calls);

    return tx.transaction_hash;
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "chainId": "0x534e5f4d41494e",
    "calls": [
      {
        "contractAddress": "0x123abc",
        "entrypoint": "claim_rewards",
        "calldata": []
      }
    ]
  }
  ```
</ResponseExample>
