Documentation Index
Fetch the complete documentation index at: https://cowswap-mintlify-seo-metadata-audit-1773652610.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The API integration allows you to interact with CoW Protocol at the lowest level, giving you complete control over order management, quote fetching, and trade execution. This is ideal for advanced integrations, backend services, and custom trading logic.Key APIs
Order Book API
The primary API for creating and managing orders on CoW Protocol.- Base URL:
https://api.cow.fi/ - Purpose: Quote generation, order submission, order management
- Authentication: No API key required for basic operations
Key Endpoints
POST /api/v1/quote- Get trading quotesPOST /api/v1/orders- Submit signed ordersGET /api/v1/orders/{uid}- Get order detailsDELETE /api/v1/orders/{uid}- Cancel ordersGET /api/v1/trades- Get trade history
Quick Start Example
1. Get a Quote
2. Sign and Submit Order
3. Monitor Order Status
Network Endpoints
CoW Protocol APIs are available on all supported networks:| Network | Production | Staging |
|---|---|---|
| Ethereum | https://api.cow.fi/mainnet/api/v1/ | https://barn.api.cow.fi/mainnet/api/v1/ |
| Gnosis Chain | https://api.cow.fi/xdai/api/v1/ | https://barn.api.cow.fi/xdai/api/v1/ |
| Arbitrum One | https://api.cow.fi/arbitrum_one/api/v1/ | https://barn.api.cow.fi/arbitrum_one/api/v1/ |
| Base | https://api.cow.fi/base/api/v1/ | https://barn.api.cow.fi/base/api/v1/ |
| Avalanche | https://api.cow.fi/avalanche/api/v1/ | https://barn.api.cow.fi/avalanche/api/v1/ |
| Polygon | https://api.cow.fi/polygon/api/v1/ | https://barn.api.cow.fi/polygon/api/v1/ |
| Lens | https://api.cow.fi/lens/api/v1/ | https://barn.api.cow.fi/lens/api/v1/ |
| BNB | https://api.cow.fi/bnb/api/v1/ | https://barn.api.cow.fi/bnb/api/v1/ |
| Linea | https://api.cow.fi/linea/api/v1/ | https://barn.api.cow.fi/linea/api/v1/ |
| Plasma | https://api.cow.fi/plasma/api/v1/ | https://barn.api.cow.fi/plasma/api/v1/ |
| Ink | https://api.cow.fi/ink/api/v1/ | https://barn.api.cow.fi/ink/api/v1/ |
| Sepolia | https://api.cow.fi/sepolia/api/v1/ | https://barn.api.cow.fi/sepolia/api/v1/ |
Order Signing
Orders must be cryptographically signed before submission. The signing process involves:- EIP-712 Domain: Chain-specific domain separator
- Order Struct: Structured order data
- Signature: ECDSA signature or pre-signed order
Error Handling
The API returns standard HTTP status codes:- 200: Success
- 400: Bad Request (invalid parameters)
- 404: Order not found
- 429: Rate limited
- 500: Internal server error
When to Use the API
- Backend integration: Server-side order management
- Custom trading logic: Advanced order types and strategies
- High-frequency trading: Programmatic order placement
- Multi-chain applications: Cross-chain arbitrage and liquidity
- Analytics platforms: Order and trade data analysis
Rate Limits
- Quote requests: 10 requests/second
- Order submission: 5 requests/second
- General endpoints: 100 requests/minute
Error Handling
For a comprehensive list of every API error code with root causes and fixes, see the Error Reference. Key errors to handle:| Error | When | Quick fix |
|---|---|---|
SellAmountDoesNotCoverFee | Quote request | Increase sell amount |
NoLiquidity | Quote request | Check token addresses and liquidity |
InvalidSignature | Order submission | Verify EIP-712 domain and signer match |
InsufficientAllowance | Order submission | Approve VaultRelayer (0xC92E8bdf79f0507f65a392b0ab4667716BFE0110) |
InsufficientBalance | Order submission | Check sell token balance covers amount |
sellAmountBeforeFee vs sellAmount
A common source of confusion:
sellAmountBeforeFee— used in the quote request. This is the total amount you want to sell, before any fees.sellAmountin the quote response — the sell amount after network costs have been deducted.feeAmountin the response — the network cost, in sell token units.
sellAmountBeforeFee = response.sellAmount + response.feeAmount
For the full fee pipeline (how protocol fees, partner fees, and slippage transform these amounts), see the Fee Model.
Understanding Quotes and Fees
The quote response contains fee breakdowns and amount stages that are essential for building correct orders:- Quote Selection —
priceQualityoptions (fast/optimal/verified), timing between quote and order, freshness best practices - How Intents Are Formed — detailed breakdown of
feeAmount,sellAmount,buyAmount, the full fee pipeline (network costs → protocol fee → partner fee → slippage), and how to construct the final signed order
Market Orders vs Limit Orders
The API supports both order types. The difference is in how you construct the order, not which endpoint you call:- Market (swap) orders — Fetch a quote first, then sign with the quoted amounts and a slippage tolerance. See Creating Swap Orders.
- Limit orders — You specify both
sellAmountandbuyAmountdirectly (no quote needed). The order fills when the market reaches your price. See Creating Limit Orders.
POST /api/v1/orders endpoint.
Next Steps
- Quickstart: Raw API (cURL) — End-to-end walkthrough: quote → sign → submit → monitor
- Order Book API Reference — Complete endpoint documentation with all parameters and response schemas
- API Explorer — Interactive API documentation
Resources
- Order Book API Reference — Detailed API documentation
- API Explorer — Interactive documentation
- Rate Limits & Quotas — Per-endpoint limits, backoff code, and troubleshooting
- Quote Selection — Quoting strategies and timing
- How Intents Are Formed — Fee pipeline and order construction
- Order Signing Guide — Cryptographic signing details
- GitHub Examples — Code examples