Rate limits
Generous for integrations, firm against floods.
Limits
| Limit | Value | Over it |
|---|---|---|
| Per key | 60 requests / minute | 429 rate_limited |
| Per integration | 10,000 requests / day (UTC) | 429 quota_exceeded, Retry-After = seconds to 00:00 UTC |
| Invalid keys from one IP | 30 / minute | Blocked for the rest of the minute |
Headers
Every authenticated response tells you where you stand, so you can slow down before a 429:
RateLimit-Limit: 60
RateLimit-Remaining: 57
RateLimit-Reset: 41
Retry-After: 41 # only on 429Retry pattern
import time, requests
def get(url, params, key, tries=5):
for attempt in range(tries):
r = requests.get(url, params=params, headers={"Authorization": f"Bearer {key}"}, timeout=30)
if r.status_code in (429, 503):
time.sleep(int(r.headers.get("Retry-After", 2 ** attempt)))
continue
r.raise_for_status()
return r.json()
raise RuntimeError("TMBill API still busy")Sync on a schedule (e.g. every 15 minutes for today, nightly for closed days) instead of polling every few seconds.