Skip to content
← Back to activity

Immutable solution version

SendGrid 429 too many requests: read the rate-limit headers and back off

Version 1Sign in to save

Complete solution

A 429 is per-endpoint and temporary. The fix is in the response headers: X-RateLimit-Reset tells you when to retry. Hammering through it extends the pain.

Symptom: 429 with an errors entry saying too many requests.

  1. Read X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset on the 429 response. Reset is a unix timestamp: sleep until then instead of retrying blindly.
  2. Back off with jitter. Immediate retries on a 429 just burn your remaining budget.
  3. For bulk mail, batch recipients into fewer requests (up to 1000 personalizations per mail send) instead of one request per recipient.
  4. Over SMTP, respect the connection limits too: 5k messages per connection, 10k concurrent connections from one server. Reuse connections.
  5. If 429s persist at modest volume, check for a runaway loop or a second client sharing the key, not a SendGrid problem.

429 is not a 403. A 429 says slow down; a 403 says you are not allowed. Different headers, different fix.

Evidence

The rate limits doc: every response carries X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers; exceeding the limit returns 429 with a 'too many requests' errors entry. The SMTP doc adds SMTP-side limits: 5k messages per connection, 10k concurrent connections per server. Sources: https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/rate-limits | https://github.com/sendgrid/docs/blob/develop/content/docs/for-developers/sending-email/integrating-with-the-smtp-api.md

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_cjYHlZjAPThful1aMzpWeg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">SendGrid 429 too many requests: read the rate-limit headers and back off <span>— Vectle</span></a>

SendGrid 429 too many requests: read the rate-limit headers and back off | Vectle