Krystal API
DeFi liquidity pool explorer and transaction API supporting 13+ blockchains.
Quick Start
Base URL: https://api.krystal.app
# Get top pools across all chains
curl "https://api.krystal.app/all/v2/lp_explorer/top_pools?skipCheckAutomation=true"
# Get pool details
curl "https://api.krystal.app/all/v1/lp_explorer/pool_detail?chainId=8453&poolAddress=0x..."
Instructions
Finding Pools
- Use Top Pools to discover high-performing pools
- Use Pool Detail for specific pool information
- Use Pool Chart for liquidity distribution visualization
Creating LP Positions
- Get pool details including
tickSpacingfrom Pool Detail - Calculate tick range aligned with pool's tick spacing
- Use Zap In to build the transaction
- Sign and send
txDatausing a web3 provider
Increasing Liquidity (Swap and Increase)
- Get position
tokenIdfrom User Positions (for Solana, also passnftMintAddress) - Use Swap and Increase with
tokenInAddress,amountIn,swapSlippage, andliquiditySlippage - Set
fundFromOwner=trueandisVault=truewhen adding to a Krystal auto-farm vault position - Sign and send
txDatausing a web3 provider (same as Zap In)
Withdrawing LP Positions (Zap Out)
- Get position
tokenIdfrom User Positions (for Solana, also passnftMintAddress) - Use Zap Out with
targetToken,liquidityPercent,swapSlippage, andwithdrawSlippage- Set
liquidityPercent = 0to claim only fees (principal stays in the pool; claimed tokens are swapped totargetToken) - Use
0 < liquidityPercent ≤ 1to withdraw principal liquidity (plus any fees) totargetToken
- Set
- Sign and send
txDatausing a web3 provider (same as Zap In)
Compounding Fees into a Position
- Get position
tokenIdfrom User Positions (for Solana, also passnftMintAddress) - Use Compound with
swapSlippageandliquiditySlippageto reinvest unclaimed fees back into the same position - Set
isVault=truewhen compounding a Krystal auto-farm vault position - Sign and send
txDatausing a web3 provider
Rebalancing Positions (Adjust Range)
- Get position
tokenIdfrom User Positions (for Solana, also passnftMintAddress) - Get pool
tickSpacingfrom Pool Detail and choose newnewTickLowerandnewTickUpperaligned with it - Use Adjust Range with
swapSlippage,liquiditySlippage, andwithdrawSlippage - On EVM chains, sign and send
txDatadirectly. On Solana, call withbuildTx=truefirst to gettxData, then sign and send it.
Exploring Vaults
- Use Vaults to list available vaults
- Filter by
category(ALL_VAULT,NEW_VAULT,BOOST_VAULT) andisAutoFarmVaultto narrow results - Evaluate vaults by
tvl,apr,riskScore, andvaultSecurities - Use Vault Profile Stats to get a wallet's aggregate vault statistics (owned, joined, yields, PnL)
Viewing Positions
- Use User Positions to list a wallet's liquidity positions
- Check
statsByChain["all"]for aggregate portfolio metrics (total PnL, APR, unclaimed fees) - Filter by
chainIdsorpositionStatus(open/closed) to narrow results - Evaluate individual positions by
pnl,apr,impermanentLoss,compareWithHodl, andstatus(IN_RANGE/OUT_RANGE) - Use
refreshAll=truefor fresh on-chain data (slower) or omit for cached data (faster)
Wallet Operations
- Use Token Search to get user's token balances
- Select input token for swap/zap operations
Key Conventions
- Always use
skipCheckAutomation=truefor faster responses - Monetary values: Returned as strings to preserve precision
- APR values: Returned as numbers (percentages)
- Native tokens: Use NativeTokenAddress placeholders
- Amounts: Always in wei (smallest unit)
Endpoints Reference
| Endpoint | Purpose |
|---|---|
| Top Pools | Discover pools by TVL, volume, APR |
| Pool Detail | Get pool info, tick spacing, incentives |
| Pool Chart | Liquidity distribution and price history |
| Zap In | Build swap + mint transaction |
| Swap and Increase | Add liquidity to existing position (swap + increase) |
| Zap Out | Build withdraw + swap transaction |
| Compound | Reinvest unclaimed fees into existing position |
| Adjust Range | Rebalance position to new tick range |
| User Positions | List wallet LP positions & stats |
| Vaults | List shared & auto-farm vaults |
| Token Search | Query wallet token balances |
Types Reference
See types.md for complete type definitions:
Core Types: Token, Pool, PoolDetail, ChainId, LPProtocolAlias
Chart Types: PoolChartData, Tick, PricePoint
Transaction Types: TxData, ZapTxInfo, SwapAmount
Position Types: UserPosition, PositionChainStats, PositionTokenAmount, PositionPool
Vault Types: Vault, VaultOwner, VaultSecurity, VaultStats
Wallet Types: WalletToken, TokenBalance