Skip to main content
GET
/
v1
/
wallet
/
defi
cURL
curl --request GET \
  --url 'https://api.coinstats.app/v1/wallet/defi?address=0x1234567890abcdef1234567890abcdef12345678&blockchain=ethereum' \
  --header 'X-API-KEY: <api-key>'
import requests

url = "https://api.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())
const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};

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

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.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;
}
package main

import (
"fmt"
"io"
"net/http"
)

func main() {

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

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-API-KEY", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.get("https://api.coinstats.app/v1/wallet/defi?address=0x1234567890abcdef1234567890abcdef12345678&blockchain=ethereum")
.header("X-API-KEY", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.coinstats.app/v1/wallet/defi")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "totalAssets": {
    "USD": 46.92,
    "ETH": 0.010799824088855844,
    "BTC": 0.0004264134046889636
  },
  "protocols": [
    {
      "id": "pancakeswap-amm-v3",
      "name": "PancakeSwap",
      "logo": "https://icons.llama.fi/pancakeswap-amm-v3.jpg",
      "totalValue": {
        "USD": 46.92,
        "ETH": 0.010799824088855844,
        "BTC": 0.0004264134046889636
      },
      "blockchain": {
        "name": "Solana",
        "icon": "https://static.coinstats.app/portfolio_images/solana_dark.png"
      },
      "chain": "solana",
      "investments": [
        {
          "id": "liquidity",
          "name": "Liquidity",
          "value": {
            "USD": 46.92,
            "ETH": 0.010799824088855844,
            "BTC": 0.0004264134046889636
          },
          "symbols": "USDC + WSOL",
          "assets": [
            {
              "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
              "title": "Deposit",
              "amount": 20.431941,
              "symbol": "USDC",
              "price": {
                "USD": 46.92,
                "ETH": 0.010799824088855844,
                "BTC": 0.0004264134046889636
              },
              "coinId": "solana",
              "logo": "https://img-v1.raydium.io/icon/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png",
              "danger": true
            }
          ],
          "poolAddress": "pancakeswap-amm-v3",
          "healthRate": 123,
          "healthRateLink": "<string>",
          "poolProjectId": "PancakeSwap",
          "unlockAt": "2025-08-28T08:35:50.384Z",
          "endAt": "2025-08-28T08:35:50.384Z",
          "isProxy": true,
          "debtRatio": 0.01,
          "debtRatioLink": "https://pancakeswap.finance/swap"
        }
      ],
      "walletAddress": "wallet_address_here",
      "url": "https://pancakeswap.finance/swap"
    }
  ]
}
{
"statusCode": 400,
"message": "Bad Request",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}
{
"statusCode": 401,
"message": "Unauthorized",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}
{
"statusCode": 403,
"message": "Forbidden",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}
{
"statusCode": 404,
"message": "Not Found",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}
{
"statusCode": 409,
"message": "Transactions not synced",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}
{
"statusCode": 429,
"message": "Rate limit exceeded",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}
{
"statusCode": 503,
"message": "Service Unavailable. Please Contact Support"
}
This endpoint is only available for OpenApi users with paid subscription.
400 credits per request
In Query field “connectionId”: credits are multiplied by the number of values.
If the value of “connectionId” in Query is “all”, multiplier is 4000 credits.
In Query field “blockchain”: credits are multiplied by the number of values.
If the value of “blockchain” in Query is “all”, multiplier is 4000 credits.
Multipliers can be applied multiple times.

  • Detailed breakdown of DeFi assets and protocols
  • Track staked tokens, LP positions, and earned rewards
  • address: Wallet address to query
  • One of connectionId or blockchain (if both provided, connectionId is used). Single value, comma-separated list, or “all”.

Authorizations

X-API-KEY
string
header
required

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.

Query Parameters

address
string
required

The wallet address for which the DeFi data is being queried. Must be a valid string representing an EVM-compatible wallet address.

Example:

"0x1234567890abcdef1234567890abcdef12345678"

connectionId
string

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.

Example:

"base-wallet"

blockchain
string

The blockchain network identifier from /wallet/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.

Example:

"base"

Response

Defi Response

totalAssets
object
required

Total value of all DeFi positions across all protocols

protocols
object[]
required

List of DeFi protocols with user positions