| name | customerio-rate-limits |
| description | Implement Customer.io rate limiting and backoff.
Use when handling high-volume API calls, implementing
retry logic, or hitting 429 errors.
Trigger: "customer.io rate limit", "customer.io throttle",
"customer.io 429", "customer.io backoff", "customer.io too many requests".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(npx:*), Glob, Grep |
| version | 1.14.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","customer-io","api","rate-limiting"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Customer.io Rate Limits
Overview
Understand Customer.io's API rate limits and implement proper throttling: token bucket limiters, exponential backoff with jitter, queue-based processing, and 429 response handling.
Rate Limit Reference
| API | Endpoint | Limit | Scope |
|---|
| Track API | identify, track, trackAnonymous | ~100 req/sec | Per workspace |
| Track API | Batch operations | ~100 req/sec | Per workspace |
| App API | Transactional email/push | ~100 req/sec | Per workspace |
| App API | Broadcasts, queries | ~10 req/sec | Per workspace |
These are approximate. Customer.io uses sliding window rate limiting. When exceeded, you get a 429 Too Many Requests response.
Instructions
Step 1: Token Bucket Rate Limiter
export class TokenBucket {
private tokens: number;
private lastRefill: number;
constructor(
private readonly maxTokens: number = 80,
private readonly refillRate: number = 80
) {
this.tokens = maxTokens;
this.lastRefill = .();
}
(): {
now = .();
elapsed = (now - .) / ;
. = .(., . + elapsed * .);
. = now;
}
(): <> {
.();
(. >= ) {
. -= ;
;
}
waitMs = (( - .) / .) * ;
( (r, .(waitMs)));
. = ;
. = .();
}
}