Skip to content
apollo-rate-limits logo

Apollo Rate Limits

apollo-rate-limits

Implement Apollo.io rate limiting and backoff. Use when handling rate limits, implementing retry logic, or optimizing API request throughput. Trigger with phrases like "apollo rate limit", "apollo 429", "apollo throttling", "apollo backoff", "apollo request limits".

SKILL.md

Full skill instructions

Apollo Rate Limits

Overview

Implement robust rate limiting and backoff strategies for Apollo.io API to maximize throughput while avoiding 429 errors.

Apollo Rate Limits

Endpoint CategoryRate LimitWindowBurst Limit
People Search100/​min1 minute10/​sec
Person Enrichment100/​min1 minute10/​sec
Organization Enrichment100/​min1 minute10/​sec
Sequences/​Campaigns50/​min1 minute5/​sec
Bulk Operations10/​min1 minute2/​sec
General API100/​min1 minute10/​sec

Rate Limit Headers

# Check current rate limit status
curl -I -X POST "https://api.apollo.io/​v1/​people/​search" \
  -H "Content-Type: application/​json" \
  -d '{"api_key": "'$APOLLO_API_KEY'", "per_page": 1}'

# Response headers:
# X-RateLimit-Limit: 100
# X-RateLimit-Remaining: 95
# X-RateLimit-Reset: 1640000000
# Retry-After: 60  (only when rate limited)

Implementation: Rate Limiter Class

// src/​lib/​apollo/​rate-limiter.ts
interface RateLimiterConfig {
  maxRequests: number;
  windowMs: number;
  minSpacingMs: number;
}

class RateLimiter {
  private queue: Array<{
    resolve: (value: void) => void;
    reject: (error: Error) => void;
  }> = [];
  private requestTimestamps: number[] = [];
  private lastRequestTime = 0;
  private processing = false;

  constructor(private config: RateLimiterConfig) {}

  async acquire(): Promise<void> {
    return new Promise((resolve, reject) => {
      this.queue.push({ resolve, reject });
      this.processQueue();
    });
  }

  private async processQueue() {
    if (this.processing || this.queue.length === 0) return;
    this.processing = true;

    while (this.queue.length > 0) {
      // Clean old timestamps outside window
      const now = Date.now();
      this.requestTimestamps = this.requestTimestamps.filter(
        (ts) => now - ts < this.config.windowMs
      );

      // Check if we're at capacity
      if (this.requestTimestamps.length >= this.config.maxRequests) {
        const oldestTs = this.requestTimestamps[0];
        const waitTime = this.config.windowMs - (now - oldestTs) + 100;
        await this.wait(waitTime);
        continue;
      }

      // Enforce minimum spacing
      const timeSinceLastRequest = now - this.lastRequestTime;
      if (timeSinceLastRequest < this.config.minSpacingMs) {
        await this.wait(this.config.minSpacingMs - timeSinceLastRequest);
      }

      // Process next request
      const item = this.queue.shift()!;
      this.requestTimestamps.push(Date.now());
      this.lastRequestTime = Date.now();
      item.resolve();
    }

    this.processing = false;
  }

  private wait(ms: number): Promise<void> {
    return new Promise((resolve) => setTimeout(resolve, ms));
  }
}

// Create rate limiter for Apollo
export const apolloRateLimiter = new RateLimiter({
  maxRequests: 90, // Leave buffer below 100
  windowMs: 60000,
  minSpacingMs: 100, // 100ms between requests
});

Implementation: Exponential Backoff

// src/​lib/​apollo/​backoff.ts
interface BackoffConfig {
  initialDelayMs: number;
  maxDelayMs: number;
  maxRetries: number;
  multiplier: number;
  jitter: boolean;
}

const defaultConfig: BackoffConfig = {
  initialDelayMs: 1000,
  maxDelayMs: 60000,
  maxRetries: 5,
  multiplier: 2,
  jitter: true,
};

export async function withBackoff<T>(
  fn: () => Promise<T>,
  config: Partial<BackoffConfig> = {}
): Promise<T> {
  const cfg = { ...defaultConfig, ...config };
  let lastError: Error;
  let delay = cfg.initialDelayMs;

  for (let attempt = 0; attempt <= cfg.maxRetries; attempt++) {
    try {
      await apolloRateLimiter.acquire();
      return await fn();
    } catch (error: any) {
      lastError = error;

      // Check if retryable
      const status = error.response?.status;
      if (status === 401 || status === 403 || status === 422) {
        throw error; // Don't retry auth/​validation errors
      }

      if (attempt === cfg.maxRetries) {
        break;
      }

      // Get delay from Retry-After header or calculate
      const retryAfter = error.response?.headers?.['retry-after'];
      if (retryAfter) {
        delay = parseInt(retryAfter) * 1000;
      }

      // Add jitter to prevent thundering herd
      const jitter = cfg.jitter ? Math.random() * 1000 : 0;
      const actualDelay = Math.min(delay + jitter, cfg.maxDelayMs);

      console.log(`Retry ${attempt + 1}/​${cfg.maxRetries} after ${actualDelay}ms`);
      await new Promise((r) => setTimeout(r, actualDelay));

      delay *= cfg.multiplier;
    }
  }

  throw lastError!;
}

Implementation: Request Queue

// src/​lib/​apollo/​request-queue.ts
import PQueue from 'p-queue';

// Concurrency-limited queue
export const apolloQueue = new PQueue({
  concurrency: 5, // Max 5 concurrent requests
  interval: 1000, // Per second
  intervalCap: 10, // Max 10 per interval
});

// Usage
async function batchSearchPeople(domains: string[]): Promise<Person[]> {
  const results = await Promise.all(
    domains.map((domain) =>
      apolloQueue.add(() =>
        withBackoff(() => apollo.searchPeople({ q_organization_domains: [domain] }))
      )
    )
  );

  return results.flat().map((r) => r?.people || []).flat();
}

Usage Patterns

Pattern 1: Simple Rate-Limited Request

import { withBackoff } from './​backoff';

const people = await withBackoff(() =>
  apollo.searchPeople({
    q_organization_domains: ['stripe.com'],
    per_page: 100,
  })
);

Pattern 2: Batch Processing with Queue

import { apolloQueue } from './​request-queue';

async function enrichCompanies(domains: string[]) {
  const results = [];

  for (const domain of domains) {
    const result = await apolloQueue.add(
      () => withBackoff(() => apollo.enrichOrganization(domain)),
      { priority: 1 } // Lower priority
    );
    results.push(result);
  }

  return results;
}

Pattern 3: Priority Queue for Interactive vs Background

// High priority for user-facing requests
async function interactiveSearch(query: string) {
  return apolloQueue.add(
    () => withBackoff(() => apollo.searchPeople({ q_keywords: query })),
    { priority: 0 } // Highest priority
  );
}

// Low priority for background sync
async function backgroundSync(contacts: string[]) {
  return Promise.all(
    contacts.map((id) =>
      apolloQueue.add(
        () => withBackoff(() => apollo.getContact(id)),
        { priority: 10 } // Low priority
      )
    )
  );
}

Monitoring Rate Limit Usage

// src/​lib/​apollo/​rate-monitor.ts
class RateLimitMonitor {
  private requests: Array<{ timestamp: number; remaining: number }> = [];

  recordRequest(remaining: number) {
    this.requests.push({
      timestamp: Date.now(),
      remaining,
    });

    // Keep only last 5 minutes
    const cutoff = Date.now() - 5 * 60 * 1000;
    this.requests = this.requests.filter((r) => r.timestamp > cutoff);
  }

  getStats() {
    const lastMinute = this.requests.filter(
      (r) => r.timestamp > Date.now() - 60000
    );

    return {
      requestsLastMinute: lastMinute.length,
      currentRemaining: lastMinute[lastMinute.length - 1]?.remaining ?? 100,
      utilizationPercent: (lastMinute.length / 100) * 100,
      isNearLimit: lastMinute.length > 80,
    };
  }
}

export const rateLimitMonitor = new RateLimitMonitor();

Output

  • Rate limiter class with token bucket algorithm
  • Exponential backoff with jitter
  • Request queue with concurrency control
  • Priority-based request scheduling
  • Rate limit monitoring and alerts

Error Handling

ScenarioStrategy
429 responseUse Retry-After header
Burst limit hitAdd minimum spacing
Sustained limitQueue with concurrency
Network timeoutExponential backoff

Resources

Next Steps

Proceed to apollo-security-basics for API security best practices.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View