The CDP API enforces rate limits to ensure fair usage and system stability. Rate limits are calculated using rolling 10-second windows and are applied separately for read and write operations.

Rate limit structure

Operation TypeRate LimitTime Window
Write APIs50 requests10 seconds
Read APIs250 requests10 seconds

Write operations

Write operations include any API endpoints that modify resources (POST, PUT, DELETE methods). These are limited to 50 requests per 10 seconds.

Read operations

Read operations include any API endpoints that retrieve data (GET methods). These are limited to 250 requests per 10 seconds.

Rate limit response

When you exceed the rate limit, the API will respond with a 429 (“Too Many Requests”) status code. The response will include an error object with details about the rate limit violation:

{
  "errorType": "rate_limit_exceeded",
  "errorMessage": "Rate limit exceeded. Please try again later."
}

Best practices

To effectively work with these rate limits, consider implementing the following best practices:

Exponential backoff

You should implement an exponential backoff strategy to handle rate limit errors.

async function withRetry(fn: () => Promise<any>) {
   let delay = 1000;
   while (true) {
      try {
      return await fn();
      } catch (e) {
      if (e.errorType === "rate_limit_exceeded") {
        await sleep(delay); // wait before retrying
        delay *= 2; // increase delay each time
        continue;
       }
      throw e;
      }
   }
}

Cache responses

Caching improves performance and reduces unnecessary load on your server or APIs. You should:

  • Cache frequently-accessed data locally when possible
  • Implement response caching for read operations that don’t require real-time data

Batch Operations

Instead of making many individual requests, combine them into a single call and use bulk endpoints when possible.

Monitor usage

Given our rate limit structure, you should track your API usage to stay within limits, and set up alerts before reaching rate limit thresholds.

Rate Limits

Consider the following when designing your application around rate limits:

Optimize API usage

  • Only request the data you need
  • Use pagination for large data sets
  • Implement efficient polling strategies

Handle rate limits gracefully

Plan for scale

  • Design your application architecture to work within these limits
  • Consider caching strategies for frequently-accessed data
  • Distribute requests evenly across time windows when possible

Support

If you consistently hit rate limits and need higher limits for your use case, please reach out to us in the #wallet-api channel of the CDP Discord to discuss your requirements.