Sume 429 rate_limited: honor retry-after and use an Idempotency-Key

On a Sume 429 rate_limited, back off using retry-after if present, and never retry an unsafe submit without an Idempotency-Key. Headers explained.

4 min readSume
All posts

On 429 rate_limited, back off. If retry-after is present, use it. Do not retry unsafe submit requests without an Idempotency-Key (read 2026-10-06 in the errors docs).

Which headers can I read?

Responses can include ratelimit-limit, ratelimit-remaining, ratelimit-reset and retry-after.

import time

def wait_seconds(headers: dict, attempt: int) -> float:
    if "retry-after" in headers:
        return float(headers["retry-after"])
    return min(60.0, 2.0 ** attempt)

print(wait_seconds({"retry-after": "7"}, 1), wait_seconds({}, 3))

What should I do in practice?

queue_full is a different 429.

  • Prefer retry-after over your own schedule.
  • Add jitter across workers.
  • Keep one idempotency key per logical request.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume