DeFi API

Query user's position list based on product#

Description: This API provides the user's asset position list for a specific investment product.

Request URL#

POST https://www.okx.com/api/v5/defi/user/investment/asset-detail

Request parameter#

Parameter nameDescriptionParameter typeRequiredData type
addressUser wallet addressRequest bodyYesString
chainIdPublic chain IDRequesNoString
investmentIdInvestment ID (investmentId and poolId cannot be empty at the same time), refer to hereRequest bodyYesString
poolIdID required for BRC-20 type investment (investmentId and poolId cannot be empty at the same time)Request bodyNoString
farmInvestmentIdID of Farm-type investment to check if it can be used for mining (only required for Uni-V3 type investments)Request bodyNoString

Response parameters#

Parameter nameDescriptionData type
investmentNameInvestment nameString
investmentIdInvestment IDString
sourceInvestmentIdSource investment IDString
investTypeInvestment type: (1: Save; 2: Pool; 3: Farm; 4: Vaults; 5: Stake)String
investNameInvestment category name: (1: Save; 2: Pool; 3: Farm; 4: Vaults; 5: Stake)String
assetsTokenListList of asset tokensArray[Struct]
>tokenSymbolToken symbolString
>tokenAddressToken contract addressString
>tokenPrecisionToken precisionString
>coinAmountToken quantityString
>currencyAmountToken value in USDString
rewardDefiTokenInfoComprehensive redemption listArray[Struct]
>baseDefiTokenInfosInformation of base tokensArray[Struct]
>>tokenSymbolToken symbolString
>>tokenAddressToken contract addressString
>>tokenPrecisionToken precisionString
>>coinAmountToken quantityString
>>currencyAmountToken value in USDString
>>networkToken networkString
>rewardTypeRedemption type: (1: Public; 2: Redeemable; 3: Airdrop; 4: Bonus)String
totalValueValue in USDString

Request example#

shell
curl --location 'https://www.okx.com/api/v5/defi/user/investment/asset-detail' \
--header 'OK-ACCESS-KEY: 9c****77' \
--header 'OK-ACCESS-PASSPHRASE: p****d' \
--header 'Content-Type: application/json' \
--data '{
  "address":"0x7f****da",
  "investmentId":"15299",
  "chainId":"137"
}'

Response example#

200
{
    "code": 0,
    "msg": "",
    "data": [
        {
            "investmentName": "Curve LP peUSD-USDC.e",
            "investmentId": "21670",
            "sourceInvestmentId": "21668",
            "investType": "3",
            "investName": "Farm",
            "assetsTokenList": [
                {
                    "tokenSymbol": "peUSDUSDC-f",
                    "tokenAddress": "0x1e2ebe2fffa7c9fa83486188f7c19f9acd1bb990",
                    "tokenPrecision": "18",
                    "coinAmount": "2.691174106339194701",
                    "currencyAmount": "2.61869989433167351725360102089837"
                }
            ],
            "rewardDefiTokenInfo": [
                {
                    "baseDefiTokenInfos": [
                        {
                            "tokenSymbol": "esLBR",
                            "tokenAddress": "0x73b1988a3336208e55275c52fac7f5d3a7dfb89f",
                            "network": "ARB",
                            "tokenPrecision": "18",
                            "coinAmount": "0.002555136460646101",
                            "currencyAmount": "0.00307009284288151737625793354325",
                            "buttonType": "0"
                        }
                    ],
                    "buttonType": "3",
                    "rewardType": "1"
                }
            ],
            "totalValue": "2.62176998717455503462985895444162"
        }
    ]
}