Skip to main content

Three ways to integrate

Whether you need a quick drop-in solution or full control over the trading stack, there’s an integration path for you.

Compare approaches

ApproachBest ForLanguageSetupCustomization
WidgetQuick integrationJSMinutesStyling & config
SDK (TS)Custom UIsTypeScriptHoursFull UI control
SDK (Py)Bots & automationPythonHoursProgrammatic
APIBackend servicesAnyDaysMaximum

Widget Integration

Widget

Pre-built trading interface you can embed in any web app
The fastest way to add CoW Protocol trading to your application. The widget provides a complete, responsive trading interface that works out of the box.
  • Zero configuration — works immediately with sensible defaults
  • Responsive design — adapts to any container size
  • Multi-network — supports all CoW Protocol chains
  • Themeable — customize colors and styling to match your brand
  • Interactive configurator — preview and generate code at widget.cow.fi
import { CowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-react'

const params: CowSwapWidgetParams = {
  appCode: 'My Dapp',
  width: '450px',
  height: '640px',
  sell: { asset: 'WETH' },
  buy: { asset: 'COW' },
}

<CowSwapWidget params={params} />

SDK Integration

TypeScript SDK

TypeScript SDK with multiple levels of abstraction
For developers who want full control over the trading UI while leveraging CoW Protocol’s features programmatically.
  • Multiple abstraction levels — from high-level trading functions to low-level API access
  • Adapter support — works with Viem, Ethers v5, and Ethers v6
  • Order management — create, sign, submit, and cancel orders
  • All order types — market, limit, TWAP, and programmatic orders
npm install @cowprotocol/cow-sdk
import { OrderBookApi, SupportedChainId } from '@cowprotocol/cow-sdk'

const orderBookApi = new OrderBookApi({ chainId: SupportedChainId.MAINNET })
const quote = await orderBookApi.getQuote(quoteRequest)
Use the SDK when you need to:
  • Build a completely custom trading UI
  • Implement complex trading logic (programmatic orders, hooks)
  • Integrate into a backend service or bot
  • Support smart contract wallets with custom signing
Use the Widget when you need to:
  • Ship quickly with minimal development
  • Provide a standard swap experience
  • Minimize maintenance burden

Python SDK (cow-py)

cow-py

Python SDK for trading bots, data analysis, and automation
The Python SDK provides a high-level interface for CoW Protocol using web3.py and asyncio.
  • One-call swapsswap_tokens() handles quoting, signing, and submission
  • Async/await — native asyncio support for concurrent operations
  • Multi-chain — Ethereum, Gnosis, Arbitrum, Base, Polygon, Avalanche, BNB, Lens
  • Type-safe — full type hints and Pydantic models
  • Subgraph access — query trading data and analytics via GraphQL
pip install cowdao-cowpy
from cowdao_cowpy.cow.swap import swap_tokens
from cowdao_cowpy.common.chains import Chain

result = await swap_tokens(
    amount=sell_amount,
    account=account,
    chain=Chain.MAINNET,
    sell_token=SELL_TOKEN,
    buy_token=BUY_TOKEN,
)
print(f"Order: {result.uid}")

API Integration

REST API

Direct HTTP access to the Orderbook API
Maximum flexibility for backend services, trading bots, and advanced integrations that need full control over every aspect of the trading flow.
  • Full control — manage the entire order lifecycle via REST
  • Language agnostic — works with any programming language
  • Real-time data — access to orderbook state, auction data, and trade history
The API requires handling order signing, fee estimation, and settlement monitoring yourself. For most use cases, the SDK provides a more ergonomic experience while still giving you full control.

Next steps

Last modified on March 12, 2026