Docs · Concepts

Rate limits and pacing

Three kinds of limit: how many requests a key can make, how gently mail servers are asked, and how much email a new sender can send a day.

Preview: may change before launch · Updated

Preview

This is how the API is planned to work. Names and fields may change before launch. The APIs are in early access: join early access to get a key when they're ready.

Requests per key

Each key can make 120 requests a minute. Email checks, through POST /verify, POST /find and GET /email-domains, have their own limit: 20 a minute and 300 a day for each account. Tell us if you need more.

Every answer carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset, and X-Credits-Remaining says how many credits you have left this period.

Retry-After

Over the limit, a request gets a 429 with the code rate_limited, and a Retry-After header with the number of seconds to wait. Wait that long, then try again.

Waiting on a 429
async function call(path, body) {
  for (let attempt = 1; ; attempt++) {
    const res = await fetch(`https://api.magpie-cloud.com/v1${path}`, {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.MAGPIE_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify(body),
      signal: AbortSignal.timeout(90_000),
    });
    if (res.status !== 429 || attempt === 5) return res;
    // Wait as long as we're told, then try again.
    const seconds = Number(res.headers.get("Retry-After")) || 10;
    await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
  }
}

How checks are paced

Verification and the finder ask other companies' mail servers, and a mail server asked too much, too fast, starts to refuse. So checks are paced on our side, whatever your own limit:

  • Per mail provider: each of our servers asks each provider only so often. Google and Microsoft are paced hardest.
  • Per company: a short first burst, then about 4 checks a minute, across all our servers.
  • Per company, per day: a cap on guesses the mail server rejects. Checks that find a real mailbox don't count.
  • IP health: every 6 hours each of our verification IP addresses is checked against spam blocklists, with its reverse DNS and SPF. One on a blocklist is benched until a check finds it clean.
The IP pool verification checks leave fromChecks are spread over a pool of IP addresses, paced so mail servers don't mistake them for address harvesting, and every IP is checked for health on a schedule.
  • IP 1Checking
  • IP 2Checking
  • IP 3Checking
  • IP 4Benched: on a blocklist

Each IP, per mail provider

  • Googlepaced hardest
  • Microsoftpaced hardest
  • Other mail serverspaced

Each IP also has a limit a minute and a limit a day.

Each company, across all IPs

A first burst, big enough to test the company for catch-all and look up two people, then about 4 checks a minute.

Rejected guesses at one company are capped each day: many rejections look like harvesting, so after the cap that company waits until tomorrow.

Every 6 hours, each IP is checked

  • DNS blocklists
  • Reverse DNS
  • SPF

A blocklisted IP is benched and not used until it's clean again.

Illustrative: the number of IPs changes.

Read the code:proxyRouter.ts,senderHealth.ts,senderHealthMonitor.ts

A check may wait its turn, so a call can take longer than usual when you send many at one company. Give your HTTP client a long timeout, such as 90 seconds, and spread work at one company over time.

Daily sending limits

Gmail and Outlook trust a new sender that starts small and grows, and send one that sends everything at once to spam. MagpieCRM on Magpie Cloud gives each workspace a daily limit that starts low and steps up each week its email is received well; the email sending API is planned to work the same way. These are the limits MagpieCRM uses today:

Daily limits while a sender warms upEach workspace's daily limit starts low and steps up each week its email is received well. Cold email and opt-in email have separate limits, so the two charts have their own scales.

Cold email, a day

Cold email, a day: daily limit by weekWeek 1: 30 a day. Week 2: 60 a day. Week 3: 100 a day. Week 4: 150 a day. Week 5: 200 a day. Week 6 onwards: 300 a day0100200300Week 1: 30 cold emails a day301Week 2: 60 cold emails a day2Week 3: 100 cold emails a day3Week 4: 150 cold emails a day4Week 5: 200 cold emails a day5Week 6 onwards: 300 cold emails a day3006+Week

Opt-in email, a day

Opt-in email, a day: daily limit by weekWeek 1: 200 a day. Week 2: 500 a day. Week 3: 1,000 a day. Week 4: 2,500 a day. Week 5: 5,000 a day. Week 6 onwards: No daily limit02.5K5KWeek 1: 200 opt-in emails a day2001Week 2: 500 opt-in emails a day2Week 3: 1,000 opt-in emails a day3Week 4: 2,500 opt-in emails a day4Week 5: 5,000 opt-in emails a day5,0005Week 6 onwards: No daily limitNo dailylimit6+Week
Daily sending limits by week
WeekCold, a dayOpt-in, a day
130200
260500
31001,000
41502,500
52005,000
6 onwards300No daily limit: your plan's allowance

A week needs at least 30 emails sent to be judged. At risk, the limit stays where it is; Poor, it steps down.

Cold email goes to people who haven't asked to hear from you; opt-in email to people who signed up. Each sending domain gets a reputation score out of 100% from the last 7 days, once 30 emails have gone out: 80% and over is good, under 50% is poor. A good week moves the limit up; a poor one moves it down.

The details, including the signals behind the score, are in MagpieCRM's sending docs.

Questions about the APIs? Email pele@magpiecrm.com.