Get portfolio positions for a user
curl --request GET \
--url https://earn.li.fi/v1/portfolio/{userAddress}/positions \
--header 'x-lifi-api-key: <api-key>'import requests
url = "https://earn.li.fi/v1/portfolio/{userAddress}/positions"
headers = {"x-lifi-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-lifi-api-key': '<api-key>'}};
fetch('https://earn.li.fi/v1/portfolio/{userAddress}/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://earn.li.fi/v1/portfolio/{userAddress}/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-lifi-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://earn.li.fi/v1/portfolio/{userAddress}/positions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-lifi-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://earn.li.fi/v1/portfolio/{userAddress}/positions")
.header("x-lifi-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://earn.li.fi/v1/portfolio/{userAddress}/positions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-lifi-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"positions": [
{
"chainId": 1,
"address": "0xa17581a9e3356d9a858b789d68b4d866e593ae94",
"protocolName": "aave-v3",
"asset": {
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6
},
"balanceUsd": "1523.45",
"balanceNative": "1523450000"
},
{
"chainId": 8453,
"address": "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A",
"protocolName": "morpho",
"asset": {
"address": "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A",
"name": "Morpho USDC Vault",
"symbol": "mUSDC",
"decimals": 18
},
"balanceUsd": "5000.00",
"balanceNative": "4901960784313725490196"
}
]
}{
"statusCode": 400,
"message": "Validation failed",
"errors": [
{
"code": "invalid_type",
"message": "Expected integer, received string",
"path": [
"chainId"
]
}
]
}Portfolio
Get portfolio positions for a user
Returns a userβs DeFi positions across all supported protocols and chains.
GET
/
v1
/
portfolio
/
{userAddress}
/
positions
Get portfolio positions for a user
curl --request GET \
--url https://earn.li.fi/v1/portfolio/{userAddress}/positions \
--header 'x-lifi-api-key: <api-key>'import requests
url = "https://earn.li.fi/v1/portfolio/{userAddress}/positions"
headers = {"x-lifi-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-lifi-api-key': '<api-key>'}};
fetch('https://earn.li.fi/v1/portfolio/{userAddress}/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://earn.li.fi/v1/portfolio/{userAddress}/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-lifi-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://earn.li.fi/v1/portfolio/{userAddress}/positions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-lifi-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://earn.li.fi/v1/portfolio/{userAddress}/positions")
.header("x-lifi-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://earn.li.fi/v1/portfolio/{userAddress}/positions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-lifi-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"positions": [
{
"chainId": 1,
"address": "0xa17581a9e3356d9a858b789d68b4d866e593ae94",
"protocolName": "aave-v3",
"asset": {
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6
},
"balanceUsd": "1523.45",
"balanceNative": "1523450000"
},
{
"chainId": 8453,
"address": "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A",
"protocolName": "morpho",
"asset": {
"address": "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A",
"name": "Morpho USDC Vault",
"symbol": "mUSDC",
"decimals": 18
},
"balanceUsd": "5000.00",
"balanceNative": "4901960784313725490196"
}
]
}{
"statusCode": 400,
"message": "Validation failed",
"errors": [
{
"code": "invalid_type",
"message": "Expected integer, received string",
"path": [
"chainId"
]
}
]
}Authorizations
Path Parameters
User's wallet address (0x-prefixed, 40 hex characters).
Pattern:
^0x[a-fA-F0-9]{40}$Response
User portfolio positions
List of active positions held by the user across all supported protocols.
Show child attributes
Show child attributes
βI

