Four 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.
Which approach should I use?
Start here. Answer the first question that applies:| If you… | Use | Time to integrate |
|---|---|---|
| Want to add a swap UI to a web app with minimal code | Widget | Minutes |
| Are building a custom trading UI in TypeScript/JavaScript | TypeScript SDK | Hours |
| Are building a trading bot, automation, or data pipeline in Python | Python SDK | Hours |
| Need full control from a backend service, use a language other than TS/Python, or need to understand the protocol at the lowest level | REST API | Days |
Not sure? Start with the Widget if you just need a swap interface. Use the TypeScript SDK if you need programmatic control from a frontend or Node.js app. Use the API only if the SDKs don’t cover your use case.
Compare approaches
| Widget | SDK (TS) | SDK (Py) | API | |
|---|---|---|---|---|
| Setup time | Minutes | Hours | Hours | Days |
| Language | JS (embed) | TypeScript | Python | Any |
| Custom UI | Theming only | Full control | N/A (backend) | Full control |
| Signing handled | Automatic | Automatic | Automatic | Manual |
| Fee computation | Automatic | Automatic | Automatic | Manual |
| Order monitoring | Built-in | SDK methods | SDK methods | Poll API |
| Order types | Swap, Limit, TWAP | Swap, Limit, TWAP, Programmatic | Swap, Limit, TWAP | All |
| Smart contract wallets | Supported | Supported | Supported | Manual |
Widget Integration
Widget
Pre-built trading interface you can embed in any web app
- 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
SDK Integration
TypeScript SDK
TypeScript SDK with multiple levels of abstraction
- Multiple abstraction levels — from high-level
postSwapOrder()to low-levelOrderBookApi - Adapter support — works with Viem, Ethers v5, and Ethers v6
- Order management — create, sign, submit, cancel, and monitor orders
- All order types — market, limit, TWAP, and programmatic orders
- Creating Swap Orders — market orders with automatic quoting
- Creating Limit Orders — price-specific orders
- Token Approvals — managing ERC-20 approvals
- Order Management — tracking and cancelling orders
When to use the SDK vs Widget
When to use the SDK vs Widget
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
- Ship quickly with minimal development
- Provide a standard swap experience
- Minimize maintenance burden
Python SDK
cow-py
Python SDK for trading bots, data analysis, and automation
web3.py and asyncio.
- One-call swaps —
swap_tokens()handles quoting, signing, and submission - Async/await — native asyncio support for concurrent operations
- Multi-chain — Ethereum, Gnosis, Arbitrum, Base, Polygon, Avalanche, BNB
- Type-safe — full type hints and Pydantic models
- Subgraph access — query trading data and analytics via GraphQL
API Integration
REST API
Direct HTTP access to the Orderbook API
- 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
Testing your integration
All integration paths should be tested on Sepolia before going to production. See the Testing Guide for the step-by-step process: get test tokens, approve, place a test order, verify settlement, then graduate to mainnet.Next steps
Widget tutorial
Step-by-step widget setup
TypeScript SDK
Get trading in minutes
Python SDK
Swap tokens with one function call
API Integration Guide
Full step-by-step API guide