API v1currentBase URLhttps://api.sendlib.com/v1Bearer API key

API

Rate limits

How rate limiting works and how to build reliable backoff.

What to expect

Rate limits protect the API and keep tail latency predictable.

When you exceed a limit, you'll receive 429 Too Many Requests.

  1. Add jittered backoff

Use exponential backoff with jitter.

  1. Cap retries

Retries are not infinite. Surface the failure when you hit a ceiling.

  1. Spread load

If you send in bursts, prefer batching (one transmission with multiple recipients) or smoothing.

Example backoff (TypeScript)

TypeScript
function sleep(ms: number) {
  return new Promise((r) => setTimeout(r, ms));
}
 
function jitter(ms: number) {
  return Math.floor(ms * (0.5 + Math.random()));
}
 
for (let attempt = 0; attempt < 5; attempt++) {
  const res = await fetch("https://api.sendlib.com/v1/me", {
    headers: { Authorization: `Bearer ${process.env.SENDLIB_API_KEY}` },
  });
 
  if (res.status !== 429) {
    if (!res.ok) throw new Error(await res.text());
    console.log(await res.json());
    break;
  }
 
  const base = 250 * 2 ** attempt;
  await sleep(jitter(Math.min(base, 5000)));
}

Next