Skip to main content

Overview

This guide walks through integrating with the CoW Protocol orderbook API — from requesting a quote, to computing the amounts you need to sign, to creating and monitoring orders. An intent in CoW Protocol is a signed message that represents a user’s wish to trade. It doesn’t execute a trade directly — instead, it delegates execution to solvers who find the optimal path.
This document explains the anatomy of intents and interaction with the API at a low level. For practical use of the protocol, it is recommended to use high-level tools such as the TypeScript SDK or Python SDK.

Base URLs

The base URL depends on the chain:
Use staging (barn) for testing. Use production for real trades.
Interactive endpoint docs: Order Book API Reference

Step 1: Request a Quote

Send your trading intention to the /quote endpoint:
The request body describes what the user wants:
For more details on quoting strategies and timing, see Quote Selection. For the full API reference, see Order Book API.
If you send a full JSON appData document in the quote request, the quote response includes both quote.appData and quote.appDataHash. Sign the hash, not the JSON string. When you create the order, submit the JSON in appData and include appDataHash for easier debugging.

Step 2: Understand the Quote Response

The /quote response provides the price information needed to build the order, including fee breakdowns.

Sell order response

Buy order response

For buy orders, sellAmount is after the protocol fee, and the feeAmount (network costs) is not yet included in the sell amount — it must be added separately.

Step 3: Compute the Amounts to Sign

The quote object is the base order returned by the backend. If you sign it exactly as returned, you are using the server-quoted amounts. Many integrations apply additional client-side slippage tolerance and optional partner fees before signing. The amount-stage vocabulary below explains how to do that safely. The quote response and order construction use a shared vocabulary of amount stages — each representing the token amount at a specific point in the fee pipeline. Understanding these terms is essential for interpreting quote values and building orders correctly.

Fee types

Several layers of fees transform the raw spot price into the final amounts signed in the order:

Protocol fee

The protocol fee is expressed as basis points (protocolFeeBps) in the quote response. Sell orders (buy token units) — quote.buyAmount is already after the protocol fee has been deducted:
Buy orders (sell token units) — the protocol fee is applied to the sum of sell amount and network costs:

Partner fee

The partner (integrator) fee is calculated as a percentage of the spot price (beforeAllFees), not the post-fee amounts. Sell orders (buy token units):
Buy orders (sell token units): same formula, but using beforeAllFees.sellAmount.

Slippage

Slippage tolerance is applied to the afterPartnerFees amount (not the spot price):

Flow for sell orders

The code below is simplified. See the full working code in CoW SDK getQuoteAmountsAndCosts.
The /quote response maps directly to afterNetworkCosts. beforeAllFees is reconstructed from it for partner fee calculations:

Flow for buy orders

The code below is simplified. See the full working code in CoW SDK getQuoteAmountsAndCosts.
The /quote sell amount maps to afterProtocolFees. The buy amount is fixed and maps to beforeAllFees:

All formulas at a glance

Below is every stage computation in one place. All values are in token atoms (integers). protocolFeeBps is in basis points (e.g. "2" = 2 bps = 0.02%). Sell order — full computation:
Buy order — full computation:

Step 4: Construct the Final Order

The signed order combines the quote API response with UI/integrator settings: The resulting order contains the afterSlippage buy amount (for sell orders) or sell amount (for buy orders), which the protocol guarantees as the minimum the user will receive (or maximum they’ll pay). The fixed amount (sellAmount for sell orders, buyAmount for buy orders), meanwhile, corresponds to the spot price amount. Sell order:
Buy order:

Step 5: Sign the Order

Sign the order using the amounts from Step 4, with the order parameters from the quote. The signing process depends on your signingScheme: The EIP-712 domain and struct types are defined by the CoW Protocol settlement contract. Sign the computed amounts (not the raw quote amounts) along with the other order parameters. If the quote response includes a full JSON quote.appData, sign quote.appDataHash. If you requested a hash-only appData, sign that hash value directly.

EIP-712 signing example (TypeScript)

Sign the computed sellAmount and buyAmount from Step 4 — not the raw values from the quote response. Set feeAmount to "0".
For additional signing examples (Foundry cast, Python eth_account), see the Quickstart: Raw API (cURL). For all four signing schemes in depth, see Signing Schemes.

Step 6: Submit the Order

Endpoint: POST /api/v1/orders
Important fields to get right:
  • feeAmount must be "0" — Fees are computed dynamically by solvers at execution time. The quote’s feeAmount is informational only.
  • sellAmount and buyAmount — Use the computed values from Step 4, NOT the raw quote.sellAmount / quote.buyAmount.
  • appData vs appDataHash — Sign the hash (quote.appDataHash when present), but submit the JSON appData document and include appDataHash alongside it.
  • quoteId — Pass the id from the quote response to link the order for slippage analysis.
  • from — Recommended. The backend verifies the signer matches this address, catching signature encoding errors early.
Submit the order before the quote response expiration timestamp. expiration is not part of the signed order payload, but it still determines whether the backend will accept the quoted fee data.

Responses

Step 7: Monitor the Order

Get order details

Endpoint: GET /api/v1/orders/{UID} Returns the full order object including execution status.

Get auction status

Endpoint: GET /api/v1/orders/{UID}/status Returns the order’s position in the auction lifecycle:
The value array lists solvers that proposed solutions for the order, with their proposed execution amounts. If the array is empty or absent, no solver included the order in their solution.

Get trades

Endpoint: GET /api/v2/trades?orderUid={UID} Returns executed trade data once the order has been settled:

Step 8: List Orders for an Account

Endpoint: GET /api/v1/account/{owner}/orders Returns all orders for an address, sorted newest-first. There are no server-side filters for status or token. To get only open orders or orders for a specific asset, you must paginate through results and filter client-side. Since orders are sorted by creation date descending, open orders will be near the top — you can stop paginating once you encounter orders with validTo in the past.

Error Handling

Quote errors (POST /api/v1/quote)

Order creation errors (POST /api/v1/orders)

For a comprehensive list of every API error code with root causes and fixes, see the Error Reference.

Pre-Flight Checklist

Before placing an order, walk through these checks. Most failed orders come down to one of these issues.

1. Token allowance to the Vault Relayer

The trader’s wallet must have approved the CoW Protocol Vault Relayer contract (0xC92E8bdf79f0507f65a392b0ab4667716BFE0110) to spend the sell token before placing the order (not before getting the quote — quotes don’t require allowance). If the allowance is insufficient, the order will be accepted by the API but solvers will not be able to execute it, and you’ll see an InsufficientAllowance error if the backend checks balances at submission time. Make sure the approval amount covers at least the signed sellAmount of the order.

2. Sufficient balance at order placement

The trader’s address must hold enough sell token to cover the full signed sellAmount at the time the order is placed — not just at the time of quoting. Quotes are informational and don’t check balances. For buy orders, remember that the signed sell amount includes protocol fees, network costs, partner fees, and slippage on top of the spot price — so the required balance is significantly higher than what you’d calculate from the raw exchange rate alone.

3. Quote amounts ≠ signing amounts

If your integration applies partner fees or client-side slippage, the sellAmount and buyAmount from the /quote response are not yet your final signing amounts. They do not include partner fees or slippage. Compute the adjusted amounts first (see Step 3) before signing. Signing the raw quote amounts in that case will result in an order with no slippage protection and missing partner fee revenue.

4. Set feeAmount to "0" on order creation

The quote response returns a non-zero feeAmount for informational purposes (showing the estimated network cost in sell token terms). When submitting the order, the feeAmount field must be "0". Solvers compute fees dynamically at execution time.

5. signingScheme must match your signature

The signingScheme you pass in the quote request determines the structure of the returned order, which in turn affects the order UID. If you request a quote with signingScheme: "eip712" but then sign with ethsign, the signature won’t match and the order will fail with InvalidSignature.

6. Quote expiration

Quotes have an expiration timestamp in ISO-8601 format. If you sign and submit after this time, the backend may reject the order. Get the quote, compute amounts, sign, and submit promptly.

7. validTo must be reasonable

Orders with validTo too close to the current time may expire before solvers can act. Orders with validTo too far in the future will be rejected with ExcessiveValidTo. If you used validFor in the quote request, the response calculates an appropriate validTo for you.

8. Pass the quoteId and from

Include quoteId (from the quote’s id field) for slippage analysis. Include from so the backend can verify the signer matches the expected address — without it, a malformed signature might silently resolve to a wrong address.

Common Failure Scenarios

Quick Reference: Full Flow

Rate Limits

  • Quote requests: 10 requests/second
  • Order submission: 5 requests/second
  • General endpoints: 100 requests/minute
For per-endpoint limits, backoff strategies, Cloudflare WAF details, and troubleshooting, see the Rate Limits & Quotas reference.

Resources

Last modified on March 17, 2026