diff --git a/docs/cow-protocol/integrate/api.mdx b/docs/cow-protocol/integrate/api.mdx index a17739f70..91f0206b4 100644 --- a/docs/cow-protocol/integrate/api.mdx +++ b/docs/cow-protocol/integrate/api.mdx @@ -282,9 +282,7 @@ try { ## Rate Limits -- **Quote requests**: 10 requests/second -- **Order submission**: 5 requests/second -- **General endpoints**: 100 requests/minute +See [API rate limits](./rate-limits.mdx) for the limits on `api.cow.fi` and how to get higher ones. ## Next Steps diff --git a/docs/cow-protocol/integrate/rate-limits.mdx b/docs/cow-protocol/integrate/rate-limits.mdx new file mode 100644 index 000000000..173f8c744 --- /dev/null +++ b/docs/cow-protocol/integrate/rate-limits.mdx @@ -0,0 +1,50 @@ +--- +title: API rate limits +description: Rate limits and fair use for the CoW Protocol API, and how to get higher limits. +sidebar_position: 7 +--- + +# API rate limits + +The CoW Protocol API at `api.cow.fi` is free to use within the limits below. Quotes and prices have the tightest limits because each one asks solvers to search for a route. + +## Limits + +Limits apply per IP address, across all networks combined. + +| Endpoints | Limit | +| --- | --- | +| Quotes and prices: `POST /api/v1/quote`, `POST /api/v1/quote/stream`, `GET /api/v1/token/{token}/native_price` | 1 per second, and 500 per hour | +| Everything else | 5 per second | + +Both quote limits apply: you can send up to 1 request per second, but no more than 500 in any hour. + +## x402 limits + +[x402](./x402.mdx) at `x402.cow.fi` has its own limits, also per IP address: + +| Endpoints on `x402.cow.fi` | Limit | +| --- | --- | +| Paid quotes | 10 per second | +| Everything else | 5 per second | + +There is no hourly cap on x402. `POST /api/v1/quote/stream` is not available on x402. + +## If you go over a limit + +You get `429 Too Many Requests` with a `Retry-After` header. Wait that long, then retry with exponential backoff. Clients that keep sending far above their limit are blocked for an hour. + +## Fair use + +- Request a quote when the user changes the trade, then refresh it at most every 30 seconds while it is on screen. +- Don't use quotes as a price feed or for analytics. +- Poll order status at most every 2 seconds, and stop once the order is filled, cancelled or expired. +- Don't spread requests across IP addresses to get around the limits. +- Set your `appCode` in the order's app data so we can recognise your integration. + +## Need higher limits? + +- **[Pay per quote with x402](./x402.mdx):** no sign-up or API key, and no hourly cap. +- **Partner API:** for integrations routing more than $1M a month in trading volume through CoW Protocol. Contact `@MooKeeper` on the [CoW Protocol Discord](https://discord.gg/cowprotocol). + +We don't raise limits on the public API. We may change these limits; this page always shows the current ones.