← Protocols
1inch
01Description

DEX aggregator across 30+ EVM chains plus Solana. Classic Swap API for AMM routing and Fusion / Fusion+ for gasless, MEV-protected, intent-based swaps settled by resolvers via Dutch auction.

02Best for
  • 01EVM aggregated swaps
  • 02gasless swaps via Fusion
  • 03MEV-protected order flow
  • 04cross-chain swaps via Fusion+
  • 05limit orders
03Install
  • pnpm add @1inch/fusion-sdk @1inch/cross-chain-sdk @1inch/limit-order-sdk
04Environment variables
VariableScopeDescription
ONEINCH_API_KEYServer1inch Dev Portal API token (passed as `authKey` to the SDK and as `Authorization: Bearer` header to REST). Generate at https://portal.1inch.dev. Server-side only — do not expose to the browser.
05Prompt snippet
Use 1inch for EVM swap aggregation. For classic AMM routing, call `GET https://api.1inch.dev/swap/v6.0/{chainId}/quote` then `/swap` with `Authorization: Bearer ${ONEINCH_API_KEY}`. For gasless / MEV-protected swaps, use `@1inch/fusion-sdk`: `const sdk = new FusionSDK({ url: 'https://api.1inch.dev/fusion', network, blockchainProvider, authKey })`, then `sdk.placeOrder({ fromTokenAddress, toTokenAddress, amount, walletAddress })`. For cross-chain, use `@1inch/cross-chain-sdk` (Fusion+) which wraps source-chain order placement and destination-chain settlement. Always proxy requests through your backend so the API key is not exposed.
06Gotchas
  • All endpoints require `Authorization: Bearer ${API_KEY}` — the key is server-side; never ship it in the browser bundle.
  • Fusion is intent-based: orders settle when a resolver fills them, so latency is variable (seconds to minutes) and orders can expire unfilled — handle the `expired`/`cancelled` states.
  • Slippage in Fusion is encoded into the Dutch auction `auctionStartAmount`/`auctionEndAmount` rather than a single `slippageBps`; misconfiguring these means the order never fills or fills at a bad price.
  • Partial fills are allowed on Fusion+ cross-chain orders — track `fills[]` in the order status, do not assume a single settlement tx.
  • Solana support is via a separate `@1inch/solana-fusion-sdk` package and uses different program IDs — do not mix EVM and Solana SDK calls in one client.
  • Token approvals: classic Swap requires ERC20 `approve` to the AggregationRouter; Fusion uses Permit2 / EIP-2612 permits where supported to make swaps gasless.
07Alternatives