> ## 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/codes/{account}

> Returns referral codes owned by an account with per-code usage stats.
Affiliate codes (is_affiliate = true) are always returned.
Non-affiliate codes are only returned if the account has >= $1,000
all-time trade volume. Maps to the Affiliates dashboard.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/affiliates/codes/{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
paths:
  /api/v1/affiliates/codes/{account}:
    get:
      tags:
        - Affiliates
      summary: GET /api/v1/affiliates/codes/{account}
      description: |-
        Returns referral codes owned by an account with per-code usage stats.
        Affiliate codes (is_affiliate = true) are always returned.
        Non-affiliate codes are only returned if the account has >= $1,000
        all-time trade volume. Maps to the Affiliates dashboard.
      operationId: handle_get_affiliate_codes
      parameters:
        - name: account
          in: path
          description: The owner's wallet address (not a subaccount address)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Affiliate codes with usage stats
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliateCodesResponseDto'
        '400':
          description: Invalid account address
        '500':
          description: Internal server error
components:
  schemas:
    AffiliateCodesResponseDto:
      type: object
      description: Response wrapper for the affiliate codes endpoint
      required:
        - owner_account
        - codes
        - volume_threshold_met
      properties:
        codes:
          type: array
          items:
            $ref: '#/components/schemas/AffiliateCodeDto'
          description: List of affiliate codes with usage stats
        owner_account:
          type: string
          description: The owner's wallet address
        volume_threshold_met:
          type: boolean
          description: |-
            Whether the account meets the minimum trade volume threshold
            to see non-affiliate (auto-generated) codes
    AffiliateCodeDto:
      type: object
      description: Per-code info returned by the affiliate codes endpoint
      required:
        - referral_code
        - owner_account
        - max_usage
        - usage_count
        - is_active
        - is_affiliate
        - source
        - created_at_ms
      properties:
        created_at_ms:
          type: integer
          format: int64
          description: When this code was created (milliseconds since epoch)
        is_active:
          type: boolean
          description: Whether the code is still active (usage_count < max_usage)
        is_affiliate:
          type: boolean
          description: Whether this is an affiliate code (high-usage codes for affiliates)
        max_usage:
          type: integer
          format: int64
          description: Maximum number of times this code can be used
          minimum: 0
        owner_account:
          type: string
          description: The wallet address that owns this code (not a subaccount address)
        referral_code:
          type: string
          description: The referral code string
        source:
          $ref: '#/components/schemas/ReferralCodeSource'
          description: How this code was created
        usage_count:
          type: integer
          format: int64
          description: Current number of times this code has been used
          minimum: 0
    ReferralCodeSource:
      type: string
      description: How a referral code was created
      enum:
        - admin
        - auto
        - unknown
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token from Geomi. See
        [Authentication](/api-reference/rest/authentication) for setup
        instructions.

````