Bitcoin.me DeFi API (1.0.0)
Download OpenAPI specification:Download
REST API for integration with the Bitcoin.me DeFi platform on KleverChain.
This API provides endpoints for:
- Pools: Query liquidity pools and their details
- Quotation: Get swap and liquidity quotes
- History: Historical data (volume, price, liquidity) for pools and tokens
- Tokens: List available tokens
- Token Factory: Manage created tokens
- Portfolio: View wallet balances and positions
- Rewards: Check reward status
- Energy: Manage energy positions and KFI locking
Response samples
- 200
[- {
- "scAddress": "string",
- "name": "string",
- "value": "string",
- "apr": "string",
- "baseName": "string",
- "quoteName": "string",
- "baseAssetId": "string",
- "quoteAssetId": "string",
- "baseIconUrl": "string",
- "quoteIconUrl": "string",
- "baseTotalStaked": "string",
- "quoteTotalStaked": "string"
}
]Get Pool Details
Returns the details of a specific pool.
path Parameters
| scAddress required | string Smart contract address of the pool |
Responses
Response samples
- 200
- 404
{- "scAddress": "string",
- "name": "string",
- "value": "string",
- "apr": "string",
- "baseName": "string",
- "quoteName": "string",
- "baseAssetId": "string",
- "quoteAssetId": "string",
- "baseIconUrl": "string",
- "quoteIconUrl": "string",
- "baseTotalStaked": "string",
- "quoteTotalStaked": "string",
- "baseTokenPrice": "string",
- "quoteTokenPrice": "string",
- "basePriceVariation": "string",
- "quotePriceVariation": "string",
- "baseVolume": "string",
- "quoteVolume": "string",
- "fees": "string"
}Get Pool Transactions
Returns the latest swap transactions of a pool.
path Parameters
| scAddress required | string Smart contract address of the pool |
Responses
Response samples
- 200
- 400
[- {
- "action": "string",
- "tokenInAbbr": "string",
- "tokenInAmount": "string",
- "tokenInAmountUsd": "string",
- "tokenInAssetId": "string",
- "tokenInIcon": "string",
- "tokenOutAbbr": "string",
- "tokenOutAmount": "string",
- "tokenOutAmountUsd": "string",
- "tokenOutAssetId": "string",
- "tokenOutIcon": "string",
- "timestamp": 0
}
]Get Pool Volume History
Returns the volume history for a specific liquidity pool, broken down by time buckets.
All history endpoints require an active ElasticSearch connection. If ElasticSearch is unavailable, a 503 Service Unavailable response is returned.
path Parameters
| scAddress required | string Smart contract address of the pool |
query Parameters
| granularity | string Default: "1d" Enum: "1h" "1d" "1w" Time bucket size. Valid values: |
| days | integer [ 1 .. 365 ] Default: 30 Number of days to look back. Range: 1 to 365 |
Responses
Response samples
- 200
- 400
- 404
- 503
{- "scAddress": "string",
- "baseToken": "string",
- "quoteToken": "string",
- "baseTokenPrice": "string",
- "quoteTokenPrice": "string",
- "data": [
- {
- "timestamp": 0,
- "baseVolume": "string",
- "quoteVolume": "string"
}
]
}Get Pool Price History
Returns the VWAP (Volume-Weighted Average Price) history for a specific pool.
Price calculations use VWAP: sum(price × volume) / sum(volume).
path Parameters
| scAddress required | string Smart contract address of the pool |
query Parameters
| granularity | string Default: "1d" Enum: "1h" "1d" "1w" Time bucket size. Valid values: |
| days | integer [ 1 .. 365 ] Default: 30 Number of days to look back. Range: 1 to 365 |
Responses
Response samples
- 200
- 400
- 404
- 503
{- "scAddress": "string",
- "baseToken": "string",
- "quoteToken": "string",
- "data": [
- {
- "timestamp": 0,
- "basePrice": "string",
- "quotePrice": "string"
}
]
}Get Pool Liquidity History
Returns the TVL (Total Value Locked) history for a specific pool, reconstructed from on-chain liquidity events.
Liquidity history is reconstructed backwards from current reserves by undoing on-chain add/remove liquidity events. This endpoint is cached for 10 minutes.
path Parameters
| scAddress required | string Smart contract address of the pool |
query Parameters
| granularity | string Default: "1d" Enum: "1h" "1d" "1w" Time bucket size. Valid values: |
| days | integer [ 1 .. 365 ] Default: 30 Number of days to look back. Range: 1 to 365 |
Responses
Response samples
- 200
- 400
- 404
- 503
{- "scAddress": "string",
- "baseToken": "string",
- "quoteToken": "string",
- "data": [
- {
- "timestamp": 0,
- "baseAmount": "string",
- "quoteAmount": "string",
- "totalValueUsd": "string"
}
]
}Get All Pools Volume History
Returns volume history for all pools in a single request.
Responses are cached for 10 minutes in Redis.
query Parameters
| granularity | string Default: "1d" Enum: "1h" "1d" "1w" Time bucket size. Valid values: |
| days | integer [ 1 .. 365 ] Default: 30 Number of days to look back. Range: 1 to 365 |
Responses
Response samples
- 200
- 400
- 503
{- "pools": [
- {
- "scAddress": "string",
- "baseToken": "string",
- "quoteToken": "string",
- "baseTokenPrice": "string",
- "quoteTokenPrice": "string",
- "data": [
- {
- "timestamp": 0,
- "baseVolume": "string",
- "quoteVolume": "string"
}
]
}
]
}Get All Pools Liquidity History
Returns liquidity (TVL) history for all pools in a single request.
Responses are cached for 10 minutes in Redis.
query Parameters
| granularity | string Default: "1d" Enum: "1h" "1d" "1w" Time bucket size. Valid values: |
| days | integer [ 1 .. 365 ] Default: 30 Number of days to look back. Range: 1 to 365 |
Responses
Response samples
- 200
- 400
- 503
{- "pools": [
- {
- "scAddress": "string",
- "baseToken": "string",
- "quoteToken": "string",
- "data": [
- {
- "timestamp": 0,
- "baseAmount": "string",
- "quoteAmount": "string",
- "totalValueUsd": "string"
}
]
}
]
}Get Swap Quotation
Gets the swap quotation between two tokens.
Request Body schema: application/jsonrequired
| amountIn required | number Input token amount |
| tokenIn required | string Input token asset ID |
| tokenOut required | string Output token asset ID |
Responses
Request samples
- Payload
{- "amountIn": 0,
- "tokenIn": "string",
- "tokenOut": "string"
}Response samples
- 200
- 400
{- "tokenIn": "string",
- "amountIn": "string",
- "amountInUsd": "string",
- "tokenOut": "string",
- "amountOut": "string",
- "amountOutUsd": "string",
- "tokenInPrice": "string",
- "tokenOutPrice": "string",
- "tokenInPriceUsd": "string",
- "tokenOutPriceUsd": "string",
- "tokenInPrecision": 0,
- "tokenOutPrecision": 0
}Get Add Liquidity Quotation
Gets the quotation for adding liquidity to a pool.
Request Body schema: application/jsonrequired
| amountIn required | number Input token amount |
| tokenIn required | string Input token asset ID |
| tokenOut required | string Output token asset ID |
Responses
Request samples
- Payload
{- "amountIn": 0,
- "tokenIn": "string",
- "tokenOut": "string"
}Response samples
- 200
{- "tokenIn": "string",
- "amountIn": "string",
- "amountInUsd": "string",
- "tokenOut": "string",
- "amountOut": "string",
- "amountOutUsd": "string",
- "tokenInPrice": "string",
- "tokenOutPrice": "string",
- "tokenInPriceUsd": "string",
- "tokenOutPriceUsd": "string",
- "tokenInPrecision": 0,
- "tokenOutPrecision": 0
}Get Token Volume History
Returns volume history for a specific token across all pools that include it. Includes price data (best-effort) from the first matching pool.
The price field is enriched on a best-effort basis. If no pool with price data is available, the field will be omitted from the response.
path Parameters
| tokenId required | string Asset ID of the token (e.g., |
query Parameters
| granularity | string Default: "1d" Enum: "1h" "1d" "1w" Time bucket size. Valid values: |
| days | integer [ 1 .. 365 ] Default: 30 Number of days to look back. Range: 1 to 365 |
Responses
Response samples
- 200
- 400
- 503
{- "tokenId": "string",
- "data": [
- {
- "timestamp": 0,
- "volume": "string",
- "price": "string"
}
]
}Get Token Price History
Returns price history for a specific token across all pools that contain it. Each pool entry includes VWAP price data points.
path Parameters
| tokenId required | string Asset ID of the token (e.g., |
query Parameters
| granularity | string Default: "1d" Enum: "1h" "1d" "1w" Time bucket size. Valid values: |
| days | integer [ 1 .. 365 ] Default: 30 Number of days to look back. Range: 1 to 365 |
Responses
Response samples
- 200
- 400
- 404
- 503
{- "tokenId": "string",
- "pools": [
- {
- "poolAddress": "string",
- "quoteToken": "string",
- "data": [
- {
- "timestamp": 0,
- "basePrice": "string",
- "quotePrice": "string"
}
]
}
]
}Get All Tokens Volume History
Returns volume history for all tokens, grouped by token ID.
query Parameters
| granularity | string Default: "1d" Enum: "1h" "1d" "1w" Time bucket size. Valid values: |
| days | integer [ 1 .. 365 ] Default: 30 Number of days to look back. Range: 1 to 365 |
Responses
Response samples
- 200
- 400
- 503
{- "data": [
- {
- "tokenId": "string",
- "data": [
- {
- "timestamp": 0,
- "volume": "string",
- "price": "string"
}
]
}
]
}Get Token Balances
Returns the token balances of an address.
path Parameters
| address required | string Bech32 wallet address |
Responses
Response samples
- 200
- 400
[- {
- "assetAbbr": "string",
- "assetName": "string",
- "assetId": "string",
- "assetPrice": "string",
- "amount": "string",
- "amountInUSD": "string",
- "iconURL": "string",
- "precision": 0
}
]Get Full Portfolio
Returns the complete portfolio of an address, including pool positions and token balances.
path Parameters
| address required | string Bech32 wallet address |
Responses
Response samples
- 200
- 400
{- "portfolioOverview": {
- "totalBalanceInUSD": "string",
- "tokenBalancesInUSD": "string",
- "poolBalancesInUSD": "string"
}, - "positions": {
- "Pool": {
- "property1": {
- "poolName": "string",
- "scAddress": "string",
- "assetId": "string",
- "rewardAssetId": "string",
- "assetAbbr": "string",
- "iconURL": "string",
- "firstTokenAmount": "string",
- "firstTokenAmountInUSD": "string",
- "firstTokenIconURL": "string",
- "secondTokenAmount": "string",
- "secondTokenAmountInUSD": "string",
- "secondTokenIconURL": "string",
- "amount": "string",
- "amountInUSD": "string",
- "unclaimedRewards": "string",
- "unclaimedRewardsInUSD": "string",
- "isClaimStakingRewardsEnable": true,
- "apr": 0,
- "minApr": 0,
- "maxApr": 0,
- "isUnbondToken": true,
- "categoryType": "string"
}, - "property2": {
- "poolName": "string",
- "scAddress": "string",
- "assetId": "string",
- "rewardAssetId": "string",
- "assetAbbr": "string",
- "iconURL": "string",
- "firstTokenAmount": "string",
- "firstTokenAmountInUSD": "string",
- "firstTokenIconURL": "string",
- "secondTokenAmount": "string",
- "secondTokenAmountInUSD": "string",
- "secondTokenIconURL": "string",
- "amount": "string",
- "amountInUSD": "string",
- "unclaimedRewards": "string",
- "unclaimedRewardsInUSD": "string",
- "isClaimStakingRewardsEnable": true,
- "apr": 0,
- "minApr": 0,
- "maxApr": 0,
- "isUnbondToken": true,
- "categoryType": "string"
}
}
}, - "tokenBalances": {
- "Token": {
- "property1": {
- "assetAbbr": "string",
- "assetName": "string",
- "assetId": "string",
- "assetPrice": "string",
- "amount": "string",
- "amountInUSD": "string",
- "iconURL": "string",
- "precision": 0,
- "categoryType": "string"
}, - "property2": {
- "assetAbbr": "string",
- "assetName": "string",
- "assetId": "string",
- "assetPrice": "string",
- "amount": "string",
- "amountInUSD": "string",
- "iconURL": "string",
- "precision": 0,
- "categoryType": "string"
}
}, - "Locked": { }
}
}Get Close Position Data
Returns the data to close an LP position.
path Parameters
| address required | string Bech32 wallet address |
| assetId required | string LP token Asset ID |
Responses
Response samples
- 200
- 400
{- "poolName": "string",
- "scAddress": "string",
- "firstTokenAmount": "string",
- "secondTokenAmount": "string",
- "firstTokenAmountInUSD": "string",
- "secondTokenAmountInUSD": "string",
- "firstTokenIconURL": "string",
- "secondTokenIconURL": "string",
- "amount": "string",
- "amountInUSD": "string"
}Get Energy Removal Penalty
Returns the penalty data for removing energy from a specific asset.
path Parameters
| address required | string Bech32 wallet address |
| assetId required | string xKFI Asset ID |
| nonce required | string SFT nonce |
Responses
Response samples
- 200
- 400
{- "removalFee": "string",
- "removalFeeInUSD": "string"
}Get Multiple Energy Removal Penalties
Returns the penalty data for removing energy from multiple assets.
Request Body schema: application/jsonrequired
| address required | string Bech32 wallet address |
| assetIds required | Array of strings List of xKFI asset IDs |
Responses
Request samples
- Payload
{- "address": "string",
- "assetIds": [
- "string"
]
}Response samples
- 200
- 400
{- "penaltyEnergyData": [
- {
- "assetId": "string",
- "removalFee": "string",
- "removalFeeInUSD": "string"
}
], - "energyPositions": [
- {
- "assetId": "string",
- "currentEnergy": "string",
- "kfiLocked": "string",
- "price": "string",
- "charge": 0
}
]
}Get Unlocked Tokens
Returns the user's unlocked tokens.
path Parameters
| address required | string Bech32 wallet address |
Responses
Response samples
- 200
- 400
[- {
- "unlockEpoch": 0,
- "lockedTokens": {
- "amount": 0,
- "tokenIdentifier": "string",
- "tokenNonce": 0
}, - "unlockedTokens": {
- "amount": 0,
- "tokenIdentifier": "string",
- "tokenNonce": 0
}
}
]