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

# GET /api/v1/affiliates/earnings/{account}

> Returns affiliate earnings breakdown for an account, including per-user
referral amps earned at L1 (10%/15%) and L2 (5%) rates.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/affiliates/earnings/{account}
openapi: 3.1.0
info:
  title: Decibel Trading API
  description: >-
    RESTful API for Decibel. Provides read-only endpoints for market data,
    trading operations, positions, and analytics.
  contact:
    name: Decibel Team
    url: https://decibel.trade/
  license:
    name: ''
  version: 1.0.0
servers:
  - url: https://api.mainnet.aptoslabs.com/decibel
    description: Mainnet
  - url: https://api.testnet.aptoslabs.com/decibel
    description: Testnet
security:
  - bearerAuth: []
tags:
  - name: Market Data
    description: Market information and real-time data endpoints
  - name: User
    description: User information and account management
  - name: Account
    description: Account-specific endpoints and data
  - name: Trades
    description: Trading operations and history
  - name: Positions
    description: User position management
  - name: Orders
    description: Order management and history
  - name: TWAP
    description: Time-weighted average price orders
  - name: Bulk Orders
    description: Bulk order management
  - name: Vaults
    description: Vault operations and management
  - name: Analytics
    description: Analytics and performance metrics
  - name: Points
    description: Points-related account metrics
  - name: Trading Points
    description: Trading points endpoints
  - name: Trading Hz
    description: Trading Hz endpoints
  - name: Tier
    description: Tier information endpoints
  - name: Streaks
    description: User streak tracking endpoints
  - name: Predeposit Rewards
    description: Season 0 predeposit USDC rewards
  - name: Referrals
    description: Referral code management and tracking
  - name: Affiliates
    description: Affiliate code and earnings endpoints
  - name: Campaigns
    description: On-chain reward campaign endpoints
paths:
  /api/v1/affiliates/earnings/{account}:
    get:
      tags:
        - Affiliates
      summary: GET /api/v1/affiliates/earnings/{account}
      description: |-
        Returns affiliate earnings breakdown for an account, including per-user
        referral amps earned at L1 (10%/15%) and L2 (5%) rates.
      operationId: handle_get_affiliate_earnings
      parameters:
        - name: account
          in: path
          description: The affiliate's wallet address
          required: true
          schema:
            type: string
        - name: limit
          in: query
          description: Page size
          required: false
          schema:
            type: integer
            format: int32
            default: 10
            maximum: 1000
            minimum: 0
          example: 100
        - name: offset
          in: query
          description: Page offset
          required: false
          schema:
            type: integer
            format: int32
            default: 0
            maximum: 10000
            minimum: 0
          example: 0
      responses:
        '200':
          description: Affiliate earnings breakdown
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliateEarningsResponseDto'
        '400':
          description: Invalid account address
        '500':
          description: Internal server error
components:
  schemas:
    AffiliateEarningsResponseDto:
      type: object
      description: Response for GET /api/v1/affiliates/earnings/{account}.
      required:
        - affiliate_account
        - is_affiliate
        - earnings
        - users
      properties:
        affiliate_account:
          type: string
          description: The affiliate's wallet address.
        earnings:
          $ref: '#/components/schemas/AffiliateEarningsBreakdownDto'
          description: Aggregated earnings breakdown.
        is_affiliate:
          type: boolean
          description: >-
            Whether this account is a managed affiliate (15% L1 rate) or normal
            referrer (10%).
        users:
          $ref: '#/components/schemas/PaginatedResponse_AffiliateReferredUserDto'
          description: Per-user referral details (paginated).
    AffiliateEarningsBreakdownDto:
      type: object
      description: Aggregated affiliate earnings split by referral level.
      required:
        - l1_amps
        - l2_amps
        - total_amps
        - l1_count
        - l2_count
      properties:
        l1_amps:
          type: number
          format: double
          description: Uncapped sum of amps earned from L1 (direct) referrals.
        l1_count:
          type: integer
          format: int64
          description: Number of L1 referred users.
          minimum: 0
        l2_amps:
          type: number
          format: double
          description: Uncapped sum of amps earned from L2 (sub-affiliate) referrals.
        l2_count:
          type: integer
          format: int64
          description: Number of L2 referred users.
          minimum: 0
        total_amps:
          type: number
          format: double
          description: Capped total referral amps from the materialized view.
    PaginatedResponse_AffiliateReferredUserDto:
      type: object
      required:
        - items
      properties:
        items:
          type: array
          items:
            type: object
            description: >-
              A referred user in the affiliate's referral tree, with their
              earned amps.
            required:
              - account
              - level
              - total_amps
              - affiliate_amps_earned
              - total_volume
              - active
            properties:
              account:
                type: string
                description: The referred user's wallet address.
              active:
                type: boolean
                description: Whether the user has traded (volume > 0).
              affiliate_amps_earned:
                type: number
                format: double
                description: >-
                  Amps earned by the affiliate from this user (total_amps *
                  rate).
              level:
                $ref: '#/components/schemas/ReferralLevel'
                description: 'Referral level: L1 (direct) or L2 (sub-affiliate).'
              referred_by:
                type:
                  - string
                  - 'null'
                description: >-
                  For L2 users, the L1 user who referred them. `None` for L1
                  users.
              total_amps:
                type: number
                format: double
                description: The user's all-time Hz from trading activity.
              total_volume:
                type: number
                format: double
                description: The user's all-time trade volume in USD.
          description: The items in the current page
        total_count:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            The total number of items across all pages.

            Optional: history endpoints omit this field to avoid expensive
            COUNT(*) queries.
          minimum: 0
    ReferralLevel:
      type: string
      description: Referral level in the affiliate tree.
      enum:
        - L1
        - L2
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token from Geomi. See
        [Authentication](/api-reference/rest/authentication) for setup
        instructions.

````