Skip to content

Rate Limits

EmacronAI CRM enforces rate limits to ensure fair usage and platform stability. When you exceed a limit, the API returns HTTP 429 Too Many Requests with a JSON body carrying retry_after_seconds.

Limits reference

EndpointLimitScopeNotes
All API endpoints1,000 requests / hour (default)Per API keyPer-key value is workspace-configurable; limited requests return 429 with retry_after_seconds in the body
POST /api/v1/whatsapp/otp/send5 OTPs / 10 min per phone; 1,000 / hour per workspacePer phone and workspace429 with retry_after_seconds in the JSON body
GET magic-link status polling1,200 requests / minutePer magic-link project key429 includes a standard Retry-After header
POST /api/v1/contactsShared key budgetPer API keyCounts against the same key budget as other endpoints

What a 429 response looks like

Rate limiting does not set X-RateLimit-* headers. The 429 response is JSON, and the retry delay is in the retry_after_seconds field of the body:

HTTP/1.1 429 Too Many Requests
Content-Type: application/json

{
  "error": "Rate limit exceeded",
  "limit": 1000,
  "window": "1 hour",
  "retry_after_seconds": 3600
}

Exceptions: magic-link status polling (GET requests with a magic-link project key) allows 1,200 requests per minute and sends a standard Retry-After header; an OTP-send 429 also sends Retry-After. The API does not track remaining quota across requests — poll your own usage instead of reading response headers.

Handling rate limits — exponential backoff

When you hit a 429, wait for retry_after_seconds from the response body before retrying. For repeated failures, use exponential backoff with jitter:

import { createClient, OutreachAgentError } from '@emacrontechnologies/outreachagent';

const oa = createClient(process.env.OUTREACHAGENT_API_KEY!);

async function sendOtpWithRetry(phone: string, maxRetries = 3) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    try {
      return await oa.otp.send({ phone });
    } catch (err) {
      if (err instanceof OutreachAgentError && err.status === 429) {
        const retryAfter = (err.raw as { retry_after_seconds?: number })?.retry_after_seconds ?? 60;
        // Add jitter: wait retry_after ± 10%
        const wait = retryAfter * 1000 * (1 + (Math.random() - 0.5) * 0.2);
        console.log(`Rate limited. Retrying in ${(wait / 1000).toFixed(1)}s...`);
        await new Promise(r => setTimeout(r, wait));
      } else {
        throw err; // non-rate-limit errors should not be retried silently
      }
    }
  }
  throw new Error(`Failed after ${maxRetries} retries`);
}

OTP-specific limits explained

5 OTPs per phone per 10 minutes

Prevents a single phone from being flooded. If a user requests OTP more than 5 times in 10 minutes, subsequent requests return 429. Show the user a countdown timer in your UI.

1,000 OTPs per workspace per hour

Workspace-level cap. For high-volume use cases (10,000+ OTPs/hour), contact sales to upgrade your plan. The limit resets every rolling hour window.

5 verify attempts per OTP

After 5 failed verify attempts, the OTP request is permanently invalidated. Force a new sendOtp() call. This prevents brute-force attacks on 6-digit codes.

OTP TTL: 10 minutes

OTPs expire 10 minutes after they are sent. The TTL is fixed and cannot be changed in the send request. After expiry, verification fails with HTTP 400 and error: "expired".

Related