Overview

1inch is a suite of decentralized finance (DeFi) protocols that facilitate efficient and secure cryptocurrency token swaps across various decentralized exchanges (DEXs). Established in 2019, 1inch addresses the fragmentation of liquidity within the DeFi ecosystem by aggregating trading opportunities from numerous sources. This allows users to execute trades at optimized rates by routing orders through the most favorable paths across multiple DEXs, such as Uniswap or SushiSwap, within a single transaction.

The core of 1inch's offering is its Aggregation Protocol, a smart contract-based solution that scans available liquidity pools and order books across supported DEXs to identify the optimal swap path for a given trade. This process considers factors like token prices, gas fees, and potential slippage to minimize the final cost for the user. For developers, the 1inch Aggregation Protocol API provides programmatic access to these optimized swap functionalities, enabling the integration of efficient token exchange capabilities into their own applications, wallets, and dApps.

In addition to the Aggregation Protocol, 1inch offers a Limit Order Protocol, which allows users to place limit orders that are executed when specific price conditions are met, similar to traditional financial markets. This protocol is gasless for order creation and can be filled by any party, enhancing flexibility in trading strategies. The 1inch ecosystem also includes a non-custodial wallet, providing a direct interface for users to interact with the protocols and manage their digital assets.

1inch is primarily designed for developers building DeFi applications that require robust token swapping capabilities, as well as for individual users seeking to maximize returns and minimize costs on their cryptocurrency trades. Its ability to route trades through diverse liquidity sources, including major platforms like Uniswap, distinguishes it in the fragmented DEX landscape. The platform supports multiple blockchain networks, including Ethereum, Polygon, and Avalanche, extending its utility across various ecosystems. Developers can leverage 1inch's SDKs and API to integrate these features, benefiting from comprehensive documentation and clear examples for JavaScript, Python, and cURL, as noted in the developer experience documentation.

Key features

  • Decentralized Exchange Aggregation: Combines liquidity from multiple DEXs to find the best trading prices and paths for token swaps.
  • Optimized Token Swaps: Utilizes sophisticated algorithms to route trades through various liquidity sources, minimizing slippage and transaction costs for users (1inch Aggregation Protocol API reference).
  • Gas-Efficient Transactions: Implements mechanisms to reduce gas fees where possible, particularly for complex multi-DEX routes.
  • Limit Order Protocol: Enables the placement of gasless limit orders that execute automatically when specific price conditions are met.
  • Multi-Chain Support: Operates across several blockchain networks, including Ethereum, Polygon, and Avalanche, expanding its reach and utility (1inch documentation).
  • Developer SDKs: Provides JavaScript and Python SDKs for easier integration into decentralized applications.
  • Non-Custodial Wallet: Offers a secure, self-custody wallet for managing digital assets and interacting with the 1inch protocols.

Pricing

1inch API access is generally free. Users are responsible for standard blockchain network transaction fees (gas fees) associated with executing swaps or other on-chain interactions through the 1inch protocols.

1inch API and Protocol Fees as of 2026-05-28
Service Component Fee Structure Notes
1inch Aggregation Protocol API Usage Free No direct charges for API requests.
Blockchain Network Transaction Fees Variable (paid by user) Applicable to all on-chain transactions (e.g., token swaps, limit order fills). Fees depend on network congestion and specific blockchain (e.g., Ethereum, Polygon).
1inch Limit Order Protocol Free to create orders Gas fees apply only when an order is filled on-chain.

For current gas prices and more details on transaction costs, users can refer to blockchain network explorers or specialized gas price trackers.

Common integrations

  • Decentralized Wallets: Integration with wallets like MetaMask or the 1inch Wallet allows users to connect and perform swaps directly.
  • DeFi Aggregators: Other DeFi platforms can integrate 1inch to enhance their swap routing capabilities.
  • DApp Development: Developers build decentralized applications that require optimized token exchange functionalities using the 1inch API (1inch developer documentation).
  • Trading Bots: Automated trading systems can utilize the 1inch API to execute trades at the best available rates across DEXs.

Alternatives

  • Uniswap: A leading decentralized exchange protocol for swapping ERC-20 tokens, known for its automated market maker (AMM) model.
  • PancakeSwap: A prominent decentralized exchange built on the BNB Smart Chain, offering token swaps, farming, and staking.
  • SushiSwap: A community-driven decentralized exchange with an AMM, yield farming, and lending features, often seen as a fork of Uniswap.

Getting started

To begin using the 1inch Aggregation Protocol API, developers can make HTTP requests to query swap routes and execute transactions. The following JavaScript example demonstrates how to fetch a swap quote for exchanging ETH for a USDC stablecoin on the Ethereum network. This example uses fetch, a standard web API for making network requests.

Before executing a swap, it is recommended to get a quote to understand the exchange rate and then approve the spending of the input token (if it's an ERC-20 token) by the 1inch router contract. Finally, the swap itself can be executed.

const fromTokenAddress = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'; // ETH address
const toTokenAddress = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';   // USDC address
const amount = '1000000000000000000'; // 1 ETH in wei
const chainId = 1; // Ethereum Mainnet

async function getSwapQuote() {
  try {
    const response = await fetch(
      `https://api.1inch.io/v5.0/${chainId}/quote?fromTokenAddress=${fromTokenAddress}&toTokenAddress=${toTokenAddress}&amount=${amount}`
    );
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    const quote = await response.json();
    console.log('Swap Quote:');
    console.log(`  From Token: ${quote.fromToken.symbol}`);
    console.log(`  To Token: ${quote.toToken.symbol}`);
    console.log(`  Estimated Amount Out: ${quote.toTokenAmount / (10 ** quote.toToken.decimals)} ${quote.toToken.symbol}`);
    console.log(`  Gas Price: ${quote.gasPrice}`);
    console.log(`  Estimated Gas: ${quote.estimatedGas}`);

    // In a real application, you would then proceed to get necessary data for calling the swap contract
    // and sending the transaction via a connected wallet (e.g., using ethers.js or web3.js).
    // Example of getting swap data (not executing here):
    // const swapResponse = await fetch(
    //   `https://api.1inch.io/v5.0/${chainId}/swap?fromTokenAddress=${fromTokenAddress}&toTokenAddress=${toTokenAddress}&amount=${amount}&fromAddress=${YOUR_WALLET_ADDRESS}&slippage=1`
    // );
    // const swapData = await swapResponse.json();
    // console.log('Swap Transaction Data:', swapData.tx);

  } catch (error) {
    console.error('Error fetching swap quote:', error);
  }
}

getSwapQuote();

This snippet queries the 1inch API for a quote, returning details about the optimal swap path and estimated output amount. To execute a swap, developers would typically use a Web3 library like Ethers.js or Web3.js to sign and send the transaction data provided by the 1inch /swap endpoint, interacting with a user's connected wallet (MDN Fetch API documentation).