If you are searching for a free DeFi API to build a trading bot, the fastest option is a DEX aggregator API that returns executable swap calldata in a single HTTP request with no API key. DEX trading bots now account for a significant share of on-chain volume, with automated trading representing over 60% of DEX transactions on major EVM chains. The DeFi trading bot market has grown alongside DEX volumes, which exceeded $13.5 billion in daily trading volume across decentralized exchanges in 2025. Building a profitable bot requires reliable price data, fast swap execution, and multi-chain coverage. This guide covers 7 free DeFi APIs that provide the core building blocks for trading bot development — from swap execution to price feeds and on-chain data.
1. Swap API (swapapi.dev) — Free DEX Aggregator
Swap API is a completely free DEX aggregator API built for trading bot developers. It returns ready-to-execute swap calldata from a single GET request across 46 EVM chains, with no API key, no registration, and no rate-limit tiers to manage.
You send a request with the chain ID, input token, output token, amount, and sender address. The API returns a complete transaction object with to, data, and value fields that you submit directly on-chain. For trading bots, this means you can go from price signal to executed trade in two steps: fetch the swap calldata, then broadcast the transaction.
curl "https://api.swapapi.dev/v1/swap/1?tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&tokenOut=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&amount=1000000000000000000&sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
The response includes expectedAmountOut, minAmountOut with slippage protection, priceImpact as a decimal, token metadata, and recommended RPC endpoints for the target chain. Partial fills return a Partial status with adjusted amounts instead of failing, which is critical for bot reliability.
Best for: Trading bots that need multi-chain swap execution with zero integration overhead. The 46-chain coverage means a single integration handles Ethereum, Arbitrum, Base, BSC, Polygon, and 41 other networks.
2. CoinGecko API — Free Price Feeds
CoinGecko provides a free tier API for cryptocurrency price data, market caps, trading volumes, and historical charts. For trading bots, this is typically the price feed layer that triggers buy/sell signals before executing swaps through a DEX aggregator.
The free tier includes 30 calls per minute with no API key required for the public endpoints. You get current prices in any fiat currency, 24-hour price changes, and market data for over 15,000 tokens. The /simple/price endpoint is the most useful for bots — it returns current prices for multiple tokens in a single request.
curl "https://api.coingecko.com/api/v3/simple/price?ids=ethereum,bitcoin&vs_currencies=usd&include_24hr_change=true"
The limitation for bot developers is the rate limit on the free tier. At 30 requests per minute, you need to batch token lookups and cache aggressively. The pro tier ($129/month) bumps this to 500 calls per minute, but the free tier works for bots that check prices on intervals rather than tick-by-tick.
Best for: Price signal generation, portfolio tracking, and triggering swap execution based on price thresholds.
3. DeFi Llama API — Free TVL and Protocol Data
DeFi Llama offers a fully free API with no API key required and no rate limits for reasonable usage. It covers total value locked (TVL) data across 3,500+ DeFi protocols, DEX trading volumes, yield farming rates, and stablecoin analytics.
For trading bots, the most relevant endpoints are the DEX volume data and the yield/pools API. The /yields/pools endpoint returns APY data across thousands of liquidity pools, which is useful for bots that farm yield or rebalance across protocols. The /dexs endpoints provide volume data that helps identify which chains and pairs have the most liquidity.
curl "https://yields.llama.fi/pools"
DeFi Llama aggregates data from primary sources and does not charge for access. The trade-off is that data updates on intervals (typically every 10-15 minutes for TVL, hourly for yields), so it is not suitable for latency-sensitive arbitrage. But for strategy bots that rebalance daily or trade on macro signals, this is the best free data source available.
Best for: Yield farming bots, TVL-based strategy signals, and identifying liquidity-rich pools across chains.
4. Alchemy Free Tier — Node Infrastructure
Alchemy provides a free tier with 300 million compute units per month, which covers roughly 12 million standard RPC calls. For trading bots, a reliable node provider is essential for reading on-chain state, checking token balances, monitoring mempool transactions, and broadcasting signed swap transactions.
The free tier supports Ethereum, Polygon, Arbitrum, Optimism, Base, and other major EVM chains. You get access to standard JSON-RPC methods plus Alchemy-specific enhanced APIs like alchemy_getTokenBalances and webhook-based notifications for address activity.
const provider = new ethers.JsonRpcProvider("https://eth-mainnet.g.alchemy.com/v2/YOUR_FREE_KEY");
const balance = await provider.getBalance("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
The compute unit model means complex calls (trace, debug, archival) consume more units than simple calls (eth_call, eth_getBalance). A trading bot that checks balances, reads prices from on-chain oracles, and sends transactions will comfortably fit within the free tier for moderate trading volumes. Note that Swap API responses also include recommended RPC URLs, which can reduce your reliance on a single node provider.
Best for: Broadcasting swap transactions, reading on-chain balances, and monitoring wallet activity.
5. Chainlink Price Feeds — Free On-Chain Oracles
Chainlink price feeds are free to read on-chain and provide decentralized, tamper-resistant price data for hundreds of token pairs. Unlike API-based price feeds, Chainlink data lives on-chain, which means your bot can read it with a simple contract call through any RPC provider.
Chainlink feeds update based on deviation thresholds (typically 0.5% for major pairs) and heartbeat intervals. For trading bots, this provides a reliable price reference that is immune to API downtime. You can read the latest price for ETH/USD, BTC/USD, and hundreds of other pairs on Ethereum, Arbitrum, Polygon, BSC, and other chains.
const priceFeed = new ethers.Contract(CHAINLINK_ETH_USD, ["function latestRoundData() view returns (uint80, int256, uint256, uint256, uint80)"], provider);
const [, price, , updatedAt] = await priceFeed.latestRoundData();
The main advantage for bot developers is that Chainlink feeds work even when centralized APIs are down. The limitation is that feeds update on deviation thresholds, not every block, so prices may lag during high-volatility periods. Combine Chainlink with a real-time price API for the best of both worlds.
Best for: On-chain price verification, stop-loss triggers, and as a fallback price source when API feeds fail.
6. Etherscan / Block Explorer APIs — Free Transaction Data
Etherscan and its multi-chain equivalents (Arbiscan, Polygonscan, BaseScan) provide free API tiers for reading transaction history, token transfers, contract ABIs, and gas prices. For trading bots, these APIs fill the analytics and monitoring gap — you can track your bot's executed trades, verify transaction receipts, and pull historical gas data to optimize submission timing.
The free tier across Etherscan APIs provides 5 calls per second with no API key, or a registered free key bumps this to roughly 5 calls/second with higher daily limits. The /api?module=gastracker endpoint is particularly useful for bots that need to time transaction submissions around gas price dips.
curl "https://api.etherscan.io/api?module=gastracker&action=gasoracle"
Each chain has its own explorer API with the same interface, so your bot code is portable. The limitation is that Etherscan data is indexed from finalized blocks, meaning there is a slight delay compared to direct RPC calls. Use this for post-trade analytics and gas optimization rather than real-time execution.
Best for: Gas price optimization, trade history tracking, and verifying bot execution results.
7. The Graph — Free Subgraph Queries
The Graph provides a decentralized indexing protocol for querying blockchain data via GraphQL. For trading bot developers, subgraphs give you structured access to DEX pool states, liquidity positions, historical swap events, and token pair data that would require thousands of RPC calls to assemble manually.
The Graph's free hosted service and the decentralized network both offer free query tiers. Uniswap, Aave, Compound, and most major DeFi protocols maintain official subgraphs. You can query pool reserves, recent swap volumes, and fee tiers in a single GraphQL request, which is invaluable for bots that select optimal trading pairs.
{ pools(first: 5, orderBy: totalValueLockedUSD, orderDirection: desc) { token0 { symbol } token1 { symbol } totalValueLockedUSD volumeUSD } }
The trade-off is query latency — subgraph data is indexed from confirmed blocks and may lag 1-5 blocks behind the chain head. For arbitrage bots that need real-time pool states, direct RPC calls to pool contracts are faster. But for strategy bots that analyze liquidity depth and volume trends, The Graph is the most efficient free option.
Best for: Analyzing DEX liquidity, tracking pool volumes, and building data-driven trading strategies.
Comparison Table
| API | Cost | API Key Required | Primary Use Case | Chain Coverage |
|---|---|---|---|---|
| Swap API | Free | No | Swap execution | 46 EVM chains |
| CoinGecko | Free tier | No (public) | Price feeds | 15,000+ tokens |
| DeFi Llama | Free | No | TVL, yields, volumes | 3,500+ protocols |
| Alchemy | Free tier | Yes | Node RPC, tx broadcast | 10+ chains |
| Chainlink | Free (on-chain) | No | On-chain price oracles | 15+ chains |
| Etherscan | Free tier | Optional | Tx history, gas data | Per-chain |
| The Graph | Free tier | Optional | DEX pool analytics | 40+ chains |
Putting It All Together
A typical trading bot stack combines 2-3 of these APIs. The minimal viable setup is a price feed (CoinGecko or Chainlink) to generate signals and a swap execution API (Swap API) to act on them. Here is a simplified flow:
- Monitor token prices via CoinGecko or Chainlink
- When a price threshold is hit, fetch swap calldata from Swap API
- Sign and broadcast the transaction via your RPC provider
- Verify execution via Etherscan or direct receipt polling
This entire stack can run at zero cost on the free tiers listed above.
FAQ
What is the best free DeFi API for trading bots?
For swap execution, Swap API (swapapi.dev) is the best free option because it requires no API key, covers 46 EVM chains, and returns executable transaction calldata in a single GET request. For price data, CoinGecko's free tier provides the broadest token coverage. Most bots combine both: a price feed for signals and a swap API for execution.
Do I need an API key to use a free DeFi API?
Not for all of them. Swap API and DeFi Llama require no API key or registration at all. CoinGecko's public endpoints work without a key but have stricter rate limits. Alchemy and Etherscan offer free tiers but require account registration to get a key. Chainlink price feeds are read directly from on-chain contracts, so no API key is needed — just an RPC connection.
How many chains can I trade on with a free DeFi API?
Swap API supports 46 EVM chains from a single endpoint, including Ethereum, Arbitrum, Base, Optimism, Polygon, BSC, Avalanche, and newer chains like Monad, MegaETH, and Berachain. This is the widest free coverage available. By comparison, most other DEX aggregator APIs that offer free tiers cover 8-15 chains.
Can I build a profitable trading bot with free APIs?
Free APIs remove the infrastructure cost, but profitability depends on your strategy, gas costs, and execution speed. The APIs listed here cover every layer of the bot stack — price data, swap execution, node access, and analytics — at zero cost. The main bottleneck for free tiers is rate limits, which matter more for high-frequency strategies than for bots that trade on longer intervals.
What is the difference between a price API and a swap API?
A price API (like CoinGecko) returns the current market price of a token. A swap API (like Swap API) returns the actual transaction data needed to execute a trade on-chain at the best available price across multiple DEX liquidity sources. Trading bots need both: price data to decide when to trade, and swap calldata to execute the trade.
Get Started
Swap API is free, requires no API key, and supports 46 EVM chains from a single endpoint. Fetch a swap quote and executable calldata in one request:
curl "https://api.swapapi.dev/v1/swap/42161?tokenIn=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&tokenOut=0xaf88d065e77c8cC2239327C5EDb3A432268e5831&amount=1000000000000000000&sender=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
The response includes everything your bot needs: the swap transaction, expected output amount, minimum output with slippage protection, and RPC endpoints to broadcast on the target chain. Start building at swapapi.dev.
Top comments (0)