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

# Get Earnings

> GET /v1/allocations/earnings — Get daily earnings history

<Note>
  **Endpoint:** `GET https://api.rebelfi.io/v1/allocations/earnings`
</Note>

Get daily earnings history for a wallet.

### Query Parameters

Provide exactly one wallet identifier, plus required filters:

| Parameter          | Type      | Required | Default | Description                                            |
| ------------------ | --------- | -------- | ------- | ------------------------------------------------------ |
| `walletAddress`    | `string`  | One of   | -       | Wallet address                                         |
| `walletId`         | `number`  | One of   | -       | Wallet ID                                              |
| `userId`           | `string`  | One of   | -       | External user ID                                       |
| `blockchain`       | `string`  | Yes      | -       | Blockchain: `solana`, `polygon`, `ethereum`, or `base` |
| `token`            | `string`  | Yes      | -       | Token symbol (e.g., `USDC`)                            |
| `days`             | `number`  | No       | `30`    | Days of history (max 365)                              |
| `includeBreakdown` | `boolean` | No       | `false` | Include per-venue breakdown                            |

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.rebelfi.io/v1/allocations/earnings?walletId=42&blockchain=ethereum&token=USDC&days=30&includeBreakdown=true" \
    -H "x-api-key: your_api_key"
  ```

  ```typescript SDK theme={null}
  const earnings = await client.allocations.earnings({
    walletId: 42,
    blockchain: 'ethereum', // or 'polygon', 'base', 'solana'
    token: 'USDC',
    days: 30,
    includeBreakdown: true
  });
  ```
</CodeGroup>

### Example Response

```json theme={null}
{
  "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
  "blockchain": "ethereum",
  "token": "USDC",
  "periodStart": "2024-01-01",
  "periodEnd": "2024-01-15",
  "firstActivityDate": "2024-01-05",
  "totalYieldEarned": "8500000",
  "totalYieldEarnedUsd": "8.50",
  "history": [
    {
      "date": "2024-01-05",
      "yieldEarned": "0",
      "yieldEarnedUsd": "0.00",
      "cumulativeYield": "0",
      "positionValue": "1000000000"
    },
    {
      "date": "2024-01-06",
      "yieldEarned": "850000",
      "yieldEarnedUsd": "0.85",
      "cumulativeYield": "850000",
      "positionValue": "1000850000"
    }
  ],
  "byVenue": [
    {
      "venueId": 3,
      "venueName": "AAVE V3",
      "totalYieldEarned": "8500000",
      "totalYieldEarnedUsd": "8.50",
      "history": [
        {
          "date": "2024-01-06",
          "yieldEarned": "850000",
          "yieldEarnedUsd": "0.85"
        }
      ]
    }
  ]
}
```

### Response Fields

| Field                 | Type               | Description                                    |
| --------------------- | ------------------ | ---------------------------------------------- |
| `walletAddress`       | `string`           | Queried wallet address                         |
| `blockchain`          | `string`           | Blockchain network                             |
| `token`               | `string`           | Token symbol                                   |
| `periodStart`         | `string`           | Start of period (YYYY-MM-DD)                   |
| `periodEnd`           | `string`           | End of period (YYYY-MM-DD)                     |
| `firstActivityDate`   | `string?`          | First date with data (null if never active)    |
| `totalYieldEarned`    | `string`           | Total yield in period (base units)             |
| `totalYieldEarnedUsd` | `string`           | Total yield in USD                             |
| `history`             | `EarningsDay[]`    | Daily earnings (sparse — only dates with data) |
| `byVenue`             | `VenueEarnings[]?` | Per-venue breakdown (if requested)             |

### EarningsDay Object

| Field             | Type     | Description                                         |
| ----------------- | -------- | --------------------------------------------------- |
| `date`            | `string` | Date (YYYY-MM-DD)                                   |
| `yieldEarned`     | `string` | Yield earned that day (base units, can be negative) |
| `yieldEarnedUsd`  | `string` | Yield in USD                                        |
| `cumulativeYield` | `string` | Cumulative yield from first activity                |
| `positionValue`   | `string` | Closing position value                              |

<Note>
  The `history` array is sparse — it only contains entries for dates where there was activity or yield. Days without activity are omitted.
</Note>
