Get detailed DeFi positions by protocol for a wallet
curl --request GET \
--url https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions \
--header 'X-API-Key: <api-key>'import requests
url = "https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
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"
"net/http"
"io"
)
func main() {
url := "https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions"
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://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions")
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{
"protocol_name": "Uniswap v2",
"protocol_id": "uniswap-v2",
"protocol_url": "https://app.uniswap.org/pools/v2",
"protocol_logo": "https://cdn.moralis.io/defi/uniswap.png",
"total_usd_value": 47754.14278954011,
"total_unclaimed_usd_value": null,
"positions": [
{
"label": "liquidity",
"tokens": [
{
"token_type": "defi-token",
"name": "Wrapped Ether",
"symbol": "WETH",
"contract_address": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
"decimals": "18",
"balance": "1000000",
"balance_formatted": "1.000000",
"logo": "https://cdn.moralis.io/tokens/0x0000000000085d4780b73119b644ae5ecd22b376.png",
"thumbnail": "https://cdn.moralis.io/tokens/0x0000000000085d4780b73119b644ae5ecd22b376.png",
"usd_price": "1000000",
"usd_value": "1000000"
}
],
"balance_usd": "1000000",
"total_unclaimed_usd_value": "1000000",
"address": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
"position_details": {
"fee_tier": 123,
"range_tnd": 123,
"reserves": [
"<string>"
],
"current_price": 123,
"is_in_range": true,
"price_upper": 123,
"price_lower": 123,
"price_label": "<string>",
"liquidity": 123,
"range_start": 123,
"pool_address": "<string>",
"position_key": "<string>",
"nft_metadata": {},
"asset_standard": "<string>",
"apy": 123,
"is_debt": true,
"is_variable_debt": true,
"is_stable_debt": true,
"shares": "<string>",
"reserve0": "<string>",
"reserve1": "<string>",
"factory": "<string>",
"pair": "<string>",
"share_of_pool": 123,
"no_price_available": true,
"shares_in_strategy": "<string>",
"strategy_address": "<string>",
"base_type": "<string>",
"health_factor": 123,
"is_enabled_collateral": true
}
}
]
}Legacy
Detailed Positions
Fetch detailed DeFi positions for a given wallet and protocol.
GET
/
wallets
/
{address}
/
defi
/
{protocol}
/
positions
Get detailed DeFi positions by protocol for a wallet
curl --request GET \
--url https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions \
--header 'X-API-Key: <api-key>'import requests
url = "https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
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"
"net/http"
"io"
)
func main() {
url := "https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions"
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://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://deep-index.moralis.io/api/v2.2/wallets/{address}/defi/{protocol}/positions")
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{
"protocol_name": "Uniswap v2",
"protocol_id": "uniswap-v2",
"protocol_url": "https://app.uniswap.org/pools/v2",
"protocol_logo": "https://cdn.moralis.io/defi/uniswap.png",
"total_usd_value": 47754.14278954011,
"total_unclaimed_usd_value": null,
"positions": [
{
"label": "liquidity",
"tokens": [
{
"token_type": "defi-token",
"name": "Wrapped Ether",
"symbol": "WETH",
"contract_address": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
"decimals": "18",
"balance": "1000000",
"balance_formatted": "1.000000",
"logo": "https://cdn.moralis.io/tokens/0x0000000000085d4780b73119b644ae5ecd22b376.png",
"thumbnail": "https://cdn.moralis.io/tokens/0x0000000000085d4780b73119b644ae5ecd22b376.png",
"usd_price": "1000000",
"usd_value": "1000000"
}
],
"balance_usd": "1000000",
"total_unclaimed_usd_value": "1000000",
"address": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
"position_details": {
"fee_tier": 123,
"range_tnd": 123,
"reserves": [
"<string>"
],
"current_price": 123,
"is_in_range": true,
"price_upper": 123,
"price_lower": 123,
"price_label": "<string>",
"liquidity": 123,
"range_start": 123,
"pool_address": "<string>",
"position_key": "<string>",
"nft_metadata": {},
"asset_standard": "<string>",
"apy": 123,
"is_debt": true,
"is_variable_debt": true,
"is_stable_debt": true,
"shares": "<string>",
"reserve0": "<string>",
"reserve1": "<string>",
"factory": "<string>",
"pair": "<string>",
"share_of_pool": 123,
"no_price_available": true,
"shares_in_strategy": "<string>",
"strategy_address": "<string>",
"base_type": "<string>",
"health_factor": 123,
"is_enabled_collateral": true
}
}
]
}Path Parameters
The protocol to query
Available options:
uniswap-v2, uniswap-v3, pancakeswap-v2, pancakeswap-v3, quickswap-v2, quickswap-v3, sushiswap-v2, aave-v2, aave-v3, aave-lido, fraxswap-v1, fraxswap-v2, lido, makerdao, eigenlayer, pendle, etherfi, rocketpool, sparkfi, takara-lend, neverland, kintsu Example:
"aave-v3"
Query Parameters
The chain to query
Available options:
eth, 0x1, sepolia, 0xaa36a7, polygon, 0x89, bsc, 0x38, bsc testnet, 0x61, avalanche, 0xa86a, cronos, 0x19, arbitrum, 0xa4b1, chiliz, 0x15b38, gnosis, 0x64, base, 0x2105, base sepolia, 0x14a34, optimism, 0xa, polygon amoy, 0x13882, linea, 0xe708, moonbeam, 0x504, moonriver, 0x505, flow, 0x2eb, flow-testnet, 0x221, ronin, 0x7e4, ronin-testnet, 0x31769, lisk, 0x46f, pulse, 0x171, sei-testnet, 0x530, sei, 0x531, monad, 0x8f Example:
"eth"
Response
200 - application/json
Returns the defi positions by protocol for the wallet address.

