# Claim unlocked block rewards

`POST /wallet/rewards/claim` · Lithos client API · Wallet · requires the `api_key` header

Source: https://lithosprotocol.org/docs/api/claim-wallet-rewards

Sweep every unlocked reward box to this wallet's primary address (EIP-3 index 0), batching boxes into as few transactions as possible. Dust is consolidated, never dropped.

A sweep that broadcasts nothing returns an error status rather than an empty 200, so a result with no claims is never ambiguous.

## Responses

### 200: The sweep transactions that were sent

`WalletRewardClaimResult`

- `claims` (WalletRewardClaimedChunk[], required)
  - `outcome` (string, required, one of accepted, rejected, uncertain): Node submission outcome for the known transaction ID.
  - `txId` (string, required)
  - `boxes` (integer · int32, required): Reward boxes this transaction swept
  - `nanoErgs` (string, required): ERG paid to the primary address by this transaction. Decimal string.
- `claimedNanoErgs` (string, required): Total ERG across every claim transaction. Decimal string.

### 400: No unlocked reward boxes to claim, or another claim is already sweeping them. 

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 403: Missing or wrong api_key

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 422: The sweep started and could not finish. `detail` carries the reason it stopped; batches broadcast before that point have still been sent. 

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 503: Node or wallet unavailable. Nothing was decided; retry.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### default: Error

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

## Example request

```bash
curl -X POST "http://localhost:9000/wallet/rewards/claim" \
  -H "api_key: $LITHOS_API_KEY"
```

## Example response

```json
{
  "claims": [
    {
      "outcome": "accepted",
      "txId": "40b7d045a858d537cdbf072e46ffbb86c0c9f6b0e93c369c1ffcba76797636d7",
      "boxes": 12,
      "nanoErgs": "36000000000"
    }
  ],
  "claimedNanoErgs": "72000000000"
}
```
