Base URLs
The Orderbook API is deployed across multiple chains with both production and staging environments:Production
- Mainnet:
https://api.cow.fi/mainnet - Gnosis Chain:
https://api.cow.fi/xdai - Arbitrum One:
https://api.cow.fi/arbitrum_one - Base:
https://api.cow.fi/base - Avalanche:
https://api.cow.fi/avalanche - Polygon:
https://api.cow.fi/polygon - Lens:
https://api.cow.fi/lens - Linea:
https://api.cow.fi/linea - BNB:
https://api.cow.fi/bnb - Plasma:
https://api.cow.fi/plasma - Ink:
https://api.cow.fi/ink - Sepolia (Testnet):
https://api.cow.fi/sepolia
Staging
- Mainnet:
https://barn.api.cow.fi/mainnet - Gnosis Chain:
https://barn.api.cow.fi/xdai - Arbitrum One:
https://barn.api.cow.fi/arbitrum_one - Base:
https://barn.api.cow.fi/base - And more…
Local Development
http://localhost:8080
Authentication
Most endpoints are public and don’t require authentication. Order placement and cancellation require EIP-712 signatures to prove ownership.Rate Limits
- Order creation: Protected against excessive order placements (HTTP 429)
- Quote requests: Protected against excessive quote requests (HTTP 429)
- Order cancellation: Best-effort cancellation to prevent in-flight settlement conflicts
Key Endpoints
Create Order
POST /api/v1/orders
Request Body
ERC-20 token to be sold (20 byte hex address with 0x prefix)
ERC-20 token to be bought (20 byte hex address with 0x prefix)
Amount of sellToken in atoms (decimal string)
Amount of buyToken in atoms (decimal string)
Unix timestamp (uint32) until which the order is valid
Full appData JSON string or appDataHash (32 bytes hex with 0x prefix). Use
"{}" for no custom appData.Fee amount in sellToken atoms. Set to “0” for new orders (fees computed dynamically by solvers).
Order type:
"sell" or "buy"Whether the order can be partially filled
Signature type:
"eip712", "ethsign", "presign", or "eip1271"65 bytes encoded as hex with 0x prefix (r || s || v)
Optional address to receive the bought tokens (defaults to owner)
Where to draw sellToken from:
"erc20", "internal", or "external"Where to transfer buyToken:
"erc20" or "internal"Address that must match the signature signer (helps catch encoding errors)
Optional quote ID to link order to a quote for slippage analysis
For debugging: hash of appData for verification
Response
Unique order identifier (56 bytes hex with 0x prefix)
201: Order accepted400: Validation error (see OrderPostError)403: Account is deny-listed404: No route found for quoting the order422: Invalid JSON429: Too many order placements500: Internal error
Error Types
Get Order
GET /api/v1/orders/{UID}
Path Parameters
56 bytes order UID encoded as hex with 0x prefix
Response
Complete order data including creation parameters and metadata
200: Order found400: Invalid order UID404: Order not found
Get Orders by Account
GET /api/v1/account/{owner}/orders
Path Parameters
Account address (20 byte hex with 0x prefix)
Query Parameters
Pagination offset
Results per page (min: 1, max: 1000)
Response
Array of order objects (see Get Order response)
200: Success400: Invalid parameters (e.g., limit too large)
Get Quote
POST /api/v1/quote
Request Body
Token to sell
Token to buy
Address that will sign the order
Quote type:
"sell" or "buy"For sell orders: total amount available (fee deducted from this)
For sell orders: exact sellAmount (fee added on top)
For buy orders: exact buyAmount desired
Absolute unix timestamp expiration
Relative validity duration in seconds
Custom recipient for bought tokens
Full appData JSON or hash
Hash to verify appData
Token source:
"erc20", "internal", or "external"Token destination:
"erc20" or "internal"Quality level:
"fast", "optimal", or "verified" (recommended)Signature type:
"eip712", "ethsign", "presign", or "eip1271"Whether order is for on-chain placement
Custom timeout in milliseconds (capped to default)
Response
Order parameters ready to sign and submit
200: Quote generated400: Error quoting order (see PriceEstimationError)404: No route found422: Invalid JSON429: Too many quote requests500: Internal error
Price Estimation Error Types
Cancel Order(s)
DELETE /api/v1/orders(multiple orders)DELETE /api/v1/orders/{UID}(single order, deprecated)
Request Body
Array of order UIDs to cancel (up to 128, only for multiple cancellation endpoint)
EIP-712 signature of OrderCancellation(s) message
Signature scheme:
"eip712" or "ethsign"200: Order(s) cancelled400: Malformed signature401: Invalid signature404: Order(s) not found422: Invalid JSON
Get Order Status
GET /api/v1/orders/{UID}/status
Response
Status:
"open", "scheduled", "active", "solved", "executing", "traded", or "cancelled"List of solvers who proposed solutions, sorted by score ascending (last = winner)
200: Status retrieved400: Invalid order UID
Get Native Token Price
GET /api/v1/token/{token}/native_price
Path Parameters
Token address
Response
Native token price (e.g., 0.0005 means 1 token = 0.0005 ETH)
200: Price retrieved400: Error finding price404: No liquidity found500: Unexpected error
Get Trades
owner or orderUid must be specified.
Endpoint: GET /api/v2/trades
Query Parameters
Filter by trader address
Filter by order UID
Pagination offset
Results per page (min: 1, max: 1000)
Response
Array of trade objects
Get Solver Competition
GET /api/v2/solver_competition/{auction_id}GET /api/v2/solver_competition/by_tx_hash/{tx_hash}GET /api/v2/solver_competition/latest
Response
Auction ID
Block where auction started
Block deadline for settlement
Winning settlement transaction hashes
Reference scores per solver (CIP-67)
Auction data (orders, prices)
All submitted solutions with rankings
AppData Management
Get AppData
GET /api/v1/app_data/{app_data_hash}
Retrieves the full appData document for a given hash.
Status Codes:
200: AppData found400: Invalid hash404: AppData not found
Register AppData
PUT /api/v1/app_data/{app_data_hash}(specify hash)PUT /api/v1/app_data(returns computed hash)
200: AppData already exists201: AppData registered400: Validation error422: Invalid JSON500: Storage error
Get Orders by Transaction Hash
GET /api/v1/orders/tx/{txHash}
Path Parameters
Settlement transaction hash (32 bytes hex with 0x prefix)
Response
Array of order objects that were included in the settlement transaction
200: Orders retrieved400: Invalid transaction hash
Get Current Batch Auction
GET /api/v1/auction
This endpoint is currently permissioned. Reach out in Discord if you need access for solver integration.
Response
Auction ID
Block number when the auction was created
Array of solvable orders in the auction
Token prices used for objective value computation
200: Auction data retrieved403: Unauthorized (permissioned endpoint)
Get User Total Surplus
GET /api/v1/users/{address}/total_surplus
Path Parameters
User’s Ethereum address
Response
Total surplus earned in the native token (e.g., ETH)
Total number of trades executed by this address
200: Surplus data retrieved400: Invalid address
Data Types
Address
20 byte Ethereum address encoded as hex with 0x prefix. Example:"0x6810e776880c02933d47db1b9fc05908e5386b96"
TokenAmount
Amount of an ERC20 token as 256-bit unsigned integer in decimal notation. Example:"1234567890"
UID
56 bytes order unique identifier encoded as hex with 0x prefix.- Bytes 0-32: Order digest
- Bytes 32-52: Owner address
- Bytes 52-56: Valid to timestamp (uint32)
"0xff2e2e54d178997f173266817c1e9ed6fee1a1aae4b43971c53b543cffcc2969845c6f5599fbb25dbdd1b9b013daf85c03f3c63763e4bc4a"
TransactionHash
32 byte digest encoded as hex with 0x prefix. Example:"0xd51f28edffcaaa76be4a22f6375ad289272c037f3cc072345676e88d92ced8b5"
AppDataHash
32 bytes encoded as hex with 0x prefix (keccak256 hash of appData JSON string). Example:"0x0000000000000000000000000000000000000000000000000000000000000000"
Order Lifecycle
- Quote: Request quote via
POST /api/v1/quote - Sign: Sign the quoted order parameters using EIP-712
- Submit: Create order via
POST /api/v1/orders - Track: Monitor status via
GET /api/v1/orders/{UID}/status - Query: Retrieve order details via
GET /api/v1/orders/{UID} - Cancel (optional): Cancel via
DELETE /api/v1/orders - Verify: Check trades via
GET /api/v2/trades
Best Practices
- Always use verified quotes: Set
priceQuality: "verified"for production orders - Link quotes to orders: Include
quoteIdwhen creating orders for better analytics - Set reasonable validTo: Don’t make orders valid for too long (gas prices fluctuate)
- Handle rate limits: Implement exponential backoff for 429 responses
- Validate signatures: Use the
fromfield to catch signature encoding errors early - Monitor order status: Poll status endpoint to track order through settlement
- Use appData wisely: Follow the appData schema for interoperability
