Welcome to Swaps
Overview
A swap is a transaction that exchanges one token for another.
Using the Coinbase Developer Platform’s Swap API, you can power your apps with onchain swap functionalities and extend trading capabilities to your users at a low cost.
The Swap API can fetch prices and reserve liquidity with unsigned transactions. For end-to-end swap execution with the smoothest developer experience, use CDP Swap API with our Wallets - supporting both regular accounts (EOAs) and Smart Accounts. We also support the use of external wallet libraries, such as viem and web3.py for building with your own infrastructure.
Key benefits
- Use with CDP ecosystem or bring your own: Smooth Coinbase ecosystem integration via our wallet accounts (EOAs), Smart Accounts (ERC-4337), or even BYO (bring your own) wallet
- Scalability: Robust rate limits for multiple users simultaneously
- Auditability: Complete swap and fee metadata for compliance
Use cases
- Agentic systems (e.g. x402) or DeFi bots: Automatically execute swaps using wallets with policy-enforced, enclave-secured signing - both EOAs and Smart Accounts
- Smart Account powered apps: Enable gasless swaps for users via paymaster sponsorship, batch multiple operations, and leverage account abstraction
- Autonomous DeFi vaults: Programmatic yield rebalancing with built-in risk controls and CDP-managed wallet infrastructure
- Regulatory-aligned automation: Secure, compliant swaps for fintech apps, stablecoin payments, and enterprise treasury flows with KYT/KYC enforcement
- AI-driven trading agents: Real-time, policy-constrained execution with sub-500ms latency—no hot keys, no custom infra
CDP and external integrations
The Swap API supports two main approaches for executing swaps, both compatible with regular accounts (EOAs) and Smart Accounts:
Approach | Features | Account Types | Best For |
---|---|---|---|
CDP Wallet | • Managed infrastructure • Automatic signing • Built-in security • USDC rewards • Gas sponsorship | • EOAs • Smart Accounts | Most use cases |
External Library | • Full control • Custom wallet infrastructure • BYO account | • EOAs • Smart Accounts (with setup) | Advanced needs |
Both options include slippage protection and optimized gas fees. Smart Accounts additionally support optional gas sponsorship through paymasters.
Why use Swap API?
The Swap API offers a favorable developer experience over existing aggregator solutions.
Feature | Swap API | Aggregator Solutions |
---|---|---|
CDP Integration | ✅ Native, unified | ❌ Manual integration |
Infrastructure | ✅ Zero setup | ❌ Self-managed |
Security | ✅ Built-in compliance | ❌ Manual implementation |
USDC Rewards | ✅ Automatic | ❌ Not available |
Development Time | ✅ Minimal | ❌ Significant |
Maintenance | ✅ Managed | ❌ Self-managed |
What to read next
- Quickstart: Get started with the Swap API and learn how to execute your first swap.
- API Reference: Explore the full CDP API v2 documentation.
- Wallet API v2: Learn more about our new Wallet API, including account management and transaction signing.
- USDC Rewards: Learn how to earn 4.1% rewards on USDC balances in your CDP wallets.