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

# Get Wallet Defi

> Retrieve comprehensive DeFi portfolio data, including staking, liquidity pool (LP), and yield farming activities

<Warning>This endpoint is only available for OpenApi users with paid subscription.</Warning><Note>**400** credits per request</Note><Accordion title="Multipliers" icon="rectangle-history-circle-plus"><Note>In **Query** field **"connectionId"**: credits are multiplied by the number of values.</Note><Note>If the value of **"connectionId"** in **Query** is **"all"**, multiplier is **4000** credits.</Note><Note>In **Query** field **"blockchain"**: credits are multiplied by the number of values.</Note><Note>If the value of **"blockchain"** in **Query** is **"all"**, multiplier is **4000** credits.</Note><Warning>Multipliers can be applied multiple times.</Warning><Info>[**Detailed multipliers explanation**](/multipliers)</Info></Accordion><hr />

<AccordionGroup>
  <Accordion title="You will get">
    * Detailed breakdown of DeFi assets and protocols
    * Track staked tokens, LP positions, and earned rewards
  </Accordion>

  <Accordion title="Required">
    * address: Wallet address to query
    * One of connectionId or blockchain (if both provided, connectionId is used). Single value, comma-separated list, or "all".
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml /api-reference/openapi.json get /v1/wallet/defi
openapi: 3.0.0
info:
  title: CoinStats Public API
  description: >-
    CoinStats Public API — programmatic access to market data, news, NFTs,
    wallets, exchange connections, and user portfolios. Authenticate every
    request with the `X-API-KEY` header (or an OAuth Bearer token in the
    `Authorization` header). Generate keys at https://openapi.coinstats.app.
  version: '1.0'
  contact: {}
servers:
  - url: https://openapiv1.coinstats.app
security: []
tags:
  - name: CoinStats
    description: ''
  - name: Market Data
    description: >-
      The Market Data section of the API provides endpoints to access a wide
      range of market-related information, including cryptocurrency coins,
      ticker data, and fiat currency rates. This category offers comprehensive
      data to help users monitor and analyze the cryptocurrency market, track
      prices, and gain insights into market trends
  - name: News
    description: >-
      The News section of the API allows you to access news articles and updates
      related to cryptocurrencies and the blockchain industry. It provides
      valuable information from various sources to keep you informed about the
      latest developments
  - name: NFTs
    description: >-
      The NFT section of the API provides endpoints to interact with
      Non-Fungible Tokens (NFTs), which are unique digital assets stored on a
      blockchain. These endpoints allow you to retrieve information about NFTs,
      including collections, assets, trending NFTs, and specific assets
      associated with wallet addresses.
  - name: Wallet Data
    description: >-
      The Wallet section of the API provides a comprehensive set of endpoints to
      manage and interact with wallets. It enables users to retrieve wallet
      balances, monitor syncing status, fetch transaction data, and synchronize
      wallet information with the blockchain. By integrating these endpoints
      into your application, you can offer robust wallet functionality to your
      users.
  - name: Exchange Connection
    description: >-
      The Exchange Connection section of the API provides a comprehensive set of
      endpoints to manage and interact with exchanges. It enables users to
      retrieve exchange balances, monitor syncing status, fetch transaction
      data. By integrating these endpoints into your application, you can offer
      robust exchange portfolio tracking functionality to your users.
  - name: User Portfolio
    description: >-
      The Portfolio section of the API provides a comprehensive set of endpoints
      to manage and interact with Share Portfolios. It enables users to retrieve
      current Portfolio Coins and Transactions.
  - name: Usage
    description: The Usage section provides account-level API usage data.
  - name: Status
    description: The Status section provides API availability checks.
paths:
  /v1/wallet/defi:
    get:
      tags:
        - Wallet Data
      summary: >-
        Retrieve comprehensive DeFi portfolio data, including staking, liquidity
        pool (LP), and yield farming activities
      operationId: get-wallet-defi
      parameters:
        - name: address
          required: true
          in: query
          description: >-
            The wallet address for which the DeFi data is being queried. Must be
            a valid string representing an EVM-compatible wallet address.
          schema:
            example: '0x1234567890abcdef1234567890abcdef12345678'
            type: string
        - name: connectionId
          required: false
          in: query
          description: >-
            Specifies the blockchain network connection ID to query for DeFi
            data. Can be a single network (e.g., "ethereum") or comma-separated
            list of networks (e.g., "ethereum,polygon-wallet") or "all" for all
            networks. Either connectionId or blockchain must be provided. If
            both are provided, connectionId will be used.
          schema:
            example: base-wallet
            type: string
        - name: blockchain
          required: false
          in: query
          description: >-
            The blockchain network identifier from
            [/wallet/blockchains](/openapi/get-blockchains) call response. Can
            be a single network (e.g., "ethereum") or a comma-separated list of
            networks (e.g., "ethereum,polygon,binance_smart"). Either
            connectionId or blockchain must be provided. If both are provided,
            connectionId will be used.
          schema:
            example: base
            type: string
      responses:
        '200':
          description: Defi Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DefiResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              example:
                statusCode: 400
                message: Bad Request
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '401':
          description: Unauthorized
          content:
            application/json:
              example:
                statusCode: 401
                message: Unauthorized
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '403':
          description: Forbidden
          content:
            application/json:
              example:
                statusCode: 403
                message: Forbidden
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '404':
          description: Not Found
          content:
            application/json:
              example:
                statusCode: 404
                message: Not Found
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '409':
          description: Conflict (for some endpoints)
          content:
            application/json:
              example:
                statusCode: 409
                message: Transactions not synced
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '429':
          description: Too Many Requests
          content:
            application/json:
              example:
                statusCode: 429
                message: Rate limit exceeded
                requestId: 11111111-2222-3333-4444-555555555555
                path: <requested-endpoint>
        '503':
          description: Service Unavailable
          content:
            application/json:
              example:
                statusCode: 503
                message: Service Unavailable. Please Contact Support
      security:
        - X-API-KEY: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl --request GET \
              --url 'https://openapiv1.coinstats.app/v1/wallet/defi?address=0x1234567890abcdef1234567890abcdef12345678&blockchain=ethereum' \
              --header 'X-API-KEY: <api-key>'
        - lang: python
          label: Python
          source: >-
            import requests


            url =
            "https://openapiv1.coinstats.app/v1/wallet/defi?address=0x1234567890abcdef1234567890abcdef12345678&blockchain=ethereum"


            headers = {"X-API-KEY": "<api-key>"}


            response = requests.request("GET", url, headers=headers)


            print(response.json())
        - lang: javascript
          label: JavaScript
          source: >-
            const options = {method: 'GET', headers: {'X-API-KEY':
            '<api-key>'}};


            fetch('https://openapiv1.coinstats.app/v1/wallet/defi?address=0x1234567890abcdef1234567890abcdef12345678&blockchain=ethereum',
            options)
              .then((response) => response.json())
              .then((response) => console.log(response))
              .catch((err) => console.error(err));
        - lang: php
          label: PHP
          source: |-
            <?php

            $curl = curl_init();

            curl_setopt_array($curl, [
              CURLOPT_URL => "https://openapiv1.coinstats.app/v1/wallet/defi?address=0x1234567890abcdef1234567890abcdef12345678&blockchain=ethereum",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "GET",
              CURLOPT_HTTPHEADER => [
                "X-API-KEY: <api-key>"
              ],
            ]);

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
        - lang: go
          label: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\n\turl := \"https://openapiv1.coinstats.app/v1/wallet/defi?address=0x1234567890abcdef1234567890abcdef12345678&blockchain=ethereum\"\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\n\treq.Header.Add(\"X-API-KEY\", \"<api-key>\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\n\tfmt.Println(string(body))\n}"
        - lang: java
          label: Java
          source: >-
            HttpResponse<String> response =
            Unirest.get("https://openapiv1.coinstats.app/v1/wallet/defi?address=0x1234567890abcdef1234567890abcdef12345678&blockchain=ethereum")
              .header("X-API-KEY", "<api-key>")
              .asString();
components:
  schemas:
    DefiResponseDto:
      type: object
      properties:
        totalAssets:
          description: Total value of all DeFi positions across all protocols
          allOf:
            - $ref: '#/components/schemas/TotalValueDto'
        protocols:
          description: List of DeFi protocols with user positions
          type: array
          items:
            $ref: '#/components/schemas/DefiItemDto'
      required:
        - totalAssets
        - protocols
    TotalValueDto:
      type: object
      properties:
        USD:
          type: number
          example: 46.92
          description: Value in US Dollars
        ETH:
          type: number
          example: 0.010799824088855844
          description: Value in Ethereum
        BTC:
          type: number
          example: 0.0004264134046889636
          description: Value in Bitcoin
      required:
        - USD
        - ETH
        - BTC
    DefiItemDto:
      type: object
      properties:
        id:
          type: string
          example: pancakeswap-amm-v3
          description: Unique identifier for the DeFi protocol
        name:
          type: string
          example: PancakeSwap
          description: Name of the DeFi protocol
        logo:
          type: string
          example: https://icons.llama.fi/pancakeswap-amm-v3.jpg
          description: URL to the protocol logo
        url:
          type: string
          example: https://pancakeswap.finance/swap
          description: Official website URL of the protocol
        totalValue:
          description: Total value of all investments in this protocol
          allOf:
            - $ref: '#/components/schemas/TotalValueDto'
        blockchain:
          description: Blockchain network information
          allOf:
            - $ref: '#/components/schemas/BlockchainDto'
        chain:
          type: string
          example: solana
          description: Blockchain network identifier
        investments:
          description: List of investments/positions in this protocol
          type: array
          items:
            $ref: '#/components/schemas/InvestmentDto'
        walletAddress:
          type: string
          example: wallet_address_here
          description: User wallet address holding these positions
      required:
        - id
        - name
        - logo
        - totalValue
        - blockchain
        - chain
        - investments
        - walletAddress
    BlockchainDto:
      type: object
      properties:
        name:
          type: string
          example: Solana
          description: Name of the blockchain network
        icon:
          type: string
          example: https://static.coinstats.app/portfolio_images/solana_dark.png
          description: URL to the blockchain icon
      required:
        - name
        - icon
    InvestmentDto:
      type: object
      properties:
        id:
          type: string
          example: liquidity
          description: Unique identifier for the investment type
        name:
          type: string
          example: Liquidity
          description: Human-readable name of the investment
        value:
          description: Total value of the investment position
          allOf:
            - $ref: '#/components/schemas/TotalValueDto'
        symbols:
          type: string
          example: USDC + WSOL
          description: Token symbols involved in the investment
        assets:
          description: List of assets in this investment
          type: array
          items:
            $ref: '#/components/schemas/AssetDto'
        poolAddress:
          type: string
          example: pancakeswap-amm-v3
          description: Address or identifier of the liquidity pool
        healthRate:
          type: number
          description: Health rate for lending positions (higher is safer)
        healthRateLink:
          type: string
          description: Link to check the health rate status
        poolProjectId:
          type: string
          example: PancakeSwap
          description: Name of the project managing the pool
        unlockAt:
          type: string
          description: Timestamp when tokens will be unlocked
          example: '2025-08-28T08:35:50.384Z'
        endAt:
          type: string
          description: Timestamp when the investment period ends
          example: '2025-08-28T08:35:50.384Z'
        isProxy:
          type: boolean
          description: Indicates if this is a proxy contract
          example: true
        debtRatio:
          type: number
          description: Debt ratio for lending positions (lower is safer)
          example: 0.01
        debtRatioLink:
          type: string
          description: Link to check the debt ratio status
          example: https://pancakeswap.finance/swap
      required:
        - id
        - name
        - value
        - symbols
        - assets
    AssetDto:
      type: object
      properties:
        address:
          type: string
          example: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
          description: Token contract address on the blockchain
        title:
          type: string
          example: Deposit
          description: Type of asset (Deposit, Reward, etc.)
        coinId:
          type: string
          example: solana
          description: CoinStats coin identifier
        logo:
          type: string
          example: >-
            https://img-v1.raydium.io/icon/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png
          description: URL to the token logo
        amount:
          type: number
          example: 20.431941
          description: Amount of the token held
        symbol:
          type: string
          example: USDC
          description: Token symbol
        price:
          description: Current price value of the asset
          allOf:
            - $ref: '#/components/schemas/TotalValueDto'
        danger:
          type: boolean
          description: Flag indicating if the asset is potentially risky
      required:
        - address
        - title
        - amount
        - symbol
        - price
  securitySchemes:
    X-API-KEY:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        API key required to access the endpoints. Generate one from your
        dashboard at https://openapi.coinstats.app and pass it in the
        `X-API-KEY` request header. Never expose your key in client-side code.

````