Looking to trade on the Coinbase App or Coinbase Exchange? The Trade API is for onchain token swaps on Ethereum and Base networks. To trade on the Coinbase App, use the Coinbase App API (for individual traders) or check out our selection of Institutional APIs.

Overview

An onchain trade (otherwise known as a swap) is a transaction that exchanges one token for another, enabling automated trading, arbitrage opportunities, and sophisticated DeFi front-end applications.
The Beta launch of our Trade API supports Ethereum and Base mainnet networks only - stay tuned for additional network support!
The Trade API provides real-time price discovery and token swaps across multiple DEXes, enabling traders to access deep liquidity pools and execute at the best available prices. For the smoothest developer experience, use CDP Trade API with our Wallets - supporting both regular accounts (EOAs) and Smart Accounts with gas sponsorship. We also support the use of external wallet libraries like viem and web3.py for building with your own infrastructure.

Key benefits

  • High-performance swaps: Sub-500ms execution latency for competitive algorithmic trading and arbitrage strategies
  • Advanced trading features: Built-in slippage protection and optimized gas management for professional traders
  • Multi-strategy support: Execute spot trading, arbitrage, market making, and yield optimization strategies from a single API
  • Use with CDP ecosystem or bring your own: Smooth integration via CDP wallet accounts (EOAs), Smart Accounts (ERC-4337), or bring your own wallet infrastructure
  • Enterprise-grade scalability: Robust rate limits supporting high-frequency trading and multiple concurrent trading bots
  • Complete trade auditability: Comprehensive swap metadata, price impact analysis, and fee breakdowns for compliance and backtesting

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 Trade API supports two main approaches for executing swaps, both compatible with regular accounts (EOAs) and Smart Accounts:
ApproachFeaturesAccount TypesBest 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 Trade API?

The Trade API provides unmatched advantages for building trading applications and automated strategies over existing aggregator solutions:
FeatureTrade APITraditional Solutions
Infrastructure✅ Zero setup required❌ Complex self-hosting
Execution Speed✅ Sub-500ms latency❌ 1-3 second delays
Bot Development✅ Native wallet integration❌ Manual key management
Multi-strategy Support✅ Concurrent execution❌ Sequential only
Gas Management✅ Automatic optimization❌ Manual configuration
Slippage Protection✅ MEV-aware routing❌ Manual implementation
  • Quickstart: Get started with the Trade API and learn how to execute your first swap.
  • API Reference: Explore the full CDP API v2 documentation.
  • Server Wallet v2: Learn more about our new Server Wallet, including account management and transaction signing.
  • USDC Rewards: Learn how to earn 4.1% rewards on USDC balances in your CDP wallets.