Prefer a higher-level approach? The cow-py SDK wraps all of this into a single
swap_tokens() call with built-in signing, quoting, and order management. This guide is for developers who want to understand the raw API mechanics or who can’t use the SDK.Prerequisites
Before starting, ensure you have:- Python 3.8+ installed
- A wallet with test tokens on Sepolia (get Sepolia ETH from a faucet, then wrap it to WETH)
- The wallet’s private key (never use a key that controls real funds for testing)
Installation
Install the required packages:Walkthrough
Before placing orders in production, review the Pre-Flight Checklist to avoid the most common integration mistakes.
Troubleshooting
For a full list of API error codes, see the Order Book API Reference.
Next Steps
Now that you have placed your first order, explore more of CoW Protocol:- cow-py SDK Quickstart — Use the Python SDK for a higher-level experience (
swap_tokens()handles everything) - TypeScript SDK Quickstart — Use the official TypeScript SDK for frontend/Node.js integrations
- Limit Orders — Place limit orders that execute at your target price
- TWAP Orders — Split large orders over time with Time-Weighted Average Price
- API Integration Guide — Complete step-by-step API reference with fee formulas and pre-flight checklist
- Testing Guide — How to test on Sepolia and graduate to production
- How Intents Are Formed — Understand the fee pipeline and amount calculations
- Signing Schemes — Learn about EIP-712,
ethSign, and pre-signed orders