curl --request GET \
--url https://api.amberdata.com/defi/lending/{protocolId}/assets/{asset} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/defi/lending/{protocolId}/assets/{asset}"
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://api.amberdata.com/defi/lending/{protocolId}/assets/{asset}', 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://api.amberdata.com/defi/lending/{protocolId}/assets/{asset}",
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://api.amberdata.com/defi/lending/{protocolId}/assets/{asset}"
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.amberdata.com/defi/lending/{protocolId}/assets/{asset}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amberdata.com/defi/lending/{protocolId}/assets/{asset}")
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{
"status": 200,
"title": "OK",
"description": "Successful request",
"payload": {
"metadata": {
"next": "https://api.amberdata.com/defi/lending/aavev2/assets/WETH?cursor=N4IgDgTg9gLlDGUA2BJAJiAXCAhjgbgKb4BMIANCALY4QDWhMWAdgK5JKUCWz8SraQgEEOAFQg5mAZxzwYXKMwCiRZjClYAZjiRTCleVUIAxKBBpNsAC1Y1mAJUI40OAEZJCFEGi4RCchWYsECEAZQBhLykYWhgAERwYT0wARgA2NJSABgAOFJSAFgBWLNLKQmY0BKSsdMyUkjSC0pbKKS4AL2SQAGYvQSIkKDBCCABZKEEtHT1KTTMLYIArKUUvMBwAc2SUyjMuTZ4dUJiIeMSdjOyAdgBONJaykH3D5h0lSurL%2Bsbmx8ocFI9DB0MEsgAPeBZEh4HA9W6uEgkHqaQg5NBZHBZQhFeAFTQka5ONC3XI9eDXIppeDwMgAXyAA"
},
"data": [
{
"action": "Withdraw",
"timestamp": "2022-08-21 11:09:05 000",
"blockNumber": 15383647,
"transactionHash": "0xc03a13328450f14094551250865c7e3b3f97ccae37a3cc1079efed098033c2b7",
"logIndex": 669,
"assetId": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"assetSymbol": "WETH",
"marketId": "0xb53c1a33016b2dc2ff3653530bff1848a515c8c5",
"market": "main",
"amount": 0.4072108498457563,
"user": "0xe26684de8d5a40a35c3fc15c9328c7f3a523759b",
"to": "0xe26684de8d5a40a35c3fc15c9328c7f3a523759b"
}
]
}
}"{}"Asset Lens
This API retrieves information about all of the actions that occurred for a specific asset on the protocol within a certain timespan.
curl --request GET \
--url https://api.amberdata.com/defi/lending/{protocolId}/assets/{asset} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/defi/lending/{protocolId}/assets/{asset}"
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://api.amberdata.com/defi/lending/{protocolId}/assets/{asset}', 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://api.amberdata.com/defi/lending/{protocolId}/assets/{asset}",
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://api.amberdata.com/defi/lending/{protocolId}/assets/{asset}"
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.amberdata.com/defi/lending/{protocolId}/assets/{asset}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amberdata.com/defi/lending/{protocolId}/assets/{asset}")
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{
"status": 200,
"title": "OK",
"description": "Successful request",
"payload": {
"metadata": {
"next": "https://api.amberdata.com/defi/lending/aavev2/assets/WETH?cursor=N4IgDgTg9gLlDGUA2BJAJiAXCAhjgbgKb4BMIANCALY4QDWhMWAdgK5JKUCWz8SraQgEEOAFQg5mAZxzwYXKMwCiRZjClYAZjiRTCleVUIAxKBBpNsAC1Y1mAJUI40OAEZJCFEGi4RCchWYsECEAZQBhLykYWhgAERwYT0wARgA2NJSABgAOFJSAFgBWLNLKQmY0BKSsdMyUkjSC0pbKKS4AL2SQAGYvQSIkKDBCCABZKEEtHT1KTTMLYIArKUUvMBwAc2SUyjMuTZ4dUJiIeMSdjOyAdgBONJaykH3D5h0lSurL%2Bsbmx8ocFI9DB0MEsgAPeBZEh4HA9W6uEgkHqaQg5NBZHBZQhFeAFTQka5ONC3XI9eDXIppeDwMgAXyAA"
},
"data": [
{
"action": "Withdraw",
"timestamp": "2022-08-21 11:09:05 000",
"blockNumber": 15383647,
"transactionHash": "0xc03a13328450f14094551250865c7e3b3f97ccae37a3cc1079efed098033c2b7",
"logIndex": 669,
"assetId": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"assetSymbol": "WETH",
"marketId": "0xb53c1a33016b2dc2ff3653530bff1848a515c8c5",
"market": "main",
"amount": 0.4072108498457563,
"user": "0xe26684de8d5a40a35c3fc15c9328c7f3a523759b",
"to": "0xe26684de8d5a40a35c3fc15c9328c7f3a523759b"
}
]
}
}"{}"Authorizations
Headers
[Optional] The id of the blockchain for which you want protocol data from. Defaults to ethereum-mainnet if not specified. Use the Information Protocols API to view the supported protocol and blockchain id combinations.
ethereum-mainnet, polygon-mainnet, avalanche-mainnet, arbitrum-mainnet, optimism-mainnet Path Parameters
aavev2, aavev3, compoundv2, makerdao [Examples] WETH The token symbol
Query Parameters
[Optional] Payload only includes data after this date (inclusive).
[Formats] seconds | milliseconds | iso8601
[Examples] 1578531600 | 1578531600000 | 2020-09-01T01:00:00
[Optional] Payload only includes data before this date (exclusive).
[Formats] seconds | milliseconds | iso8601
[Examples] 1578531600 | 1578531600000 | 2020-09-01T01:00:00
[Optional] Number of records per page. If not specified, the API will default to and try to return 1000 actions under payload.data.
[Optional] The order in which to return the results (ascending or descending). By default. records are returned in ascending order, so the oldest records are returned first.
asc, desc [Optional] Time format of the timestamps in the return payload.
milliseconds, ms, iso, iso8601, hr, human_readable [Optional] Payload only includes data filtered by the action.
[Examples] UseReserveAsCollateral|Deposit|Withdraw|LiquidationCall|Repay|Borrow|FlashLoan
Deposit, Withdraw, LiquidationCall, Repay, Borrow, FlashLoan Was this page helpful?