news api 429 quota exceeded, request failed
This skill fixes News API 429 quota-exceeded failures. Use it when briefing-time polling trips rate limits or when designing quota-safe news intake. It is not for dodging quotas with extra keys; the fix is reading quota headers, Retry-After backoff, caching article payloads, and spreading polls across the day.
News API 429 quota exceeded, request failed
TL;DR
A 429 from a news API means the briefing agent burned through its request quota, and the fix is quota discipline, not faster retries. Read the rate-limit headers on every response, cache article payloads so no URL is fetched twice, and spread polling across the day instead of bursting at briefing time. When the quota is genuinely too small, upgrade the plan or add a second source rather than hammering the limit.
The error
HTTP 429 Too Many Requests
{"status":"error","code":"rateLimited","message":"You have made too many requests recently."}When this helps
- news API calls start returning 429s mid briefing
- a news agent bursts all requests at briefing time
- designing quota-safe polling for a briefing pipeline
- deciding whether to upgrade a news API plan
When it doesn't
- the 429 comes with an account suspension notice; contact support instead
- you want to dodge the quota with multiple free keys; that violates the terms
- the API is down; 429 is throttling, 5xx is outage
Works with
NewsAPI.org and similar REST news APIs as of 2026; python 3.8+ with requests. Quota headers vary by provider.
Steps
1. Read the quota headers to see where the budget went
K="apiKey"
curl -s -D headers.txt "https://newsapi.org/v2/top-headlines?country=us&${K}=${NEWSAPI_KEY}" -o news.json
grep -i "x-ratelimit\|retry-after" headers.txt || echo "no quota headers"Expected: The remaining quota and reset time. Most news APIs return these headers; the numbers tell you whether the agent bursts or leaks requests.
2. Add backoff that honors Retry-After
import time, requests, os
s = requests.Session()
for attempt in range(4):
r = s.get("https://newsapi.org/v2/everything", params={"q": "[topic]", "apiKey": os.environ["NEWSAPI_KEY"]}, timeout=30)
if r.status_code != 429:
break
wait = int(r.headers.get("Retry-After", 60))
print("429, waiting", wait)
time.sleep(wait)
print("final", r.status_code)Expected: A non-429 response or a clean stop after 4 attempts. Backoff keeps a quota breach from becoming an account flag.
3. Cache every article payload by URL
import hashlib, json, os
url = "https://YOUR-publisher/[article]"
fp = hashlib.md5(url.encode()).hexdigest()
print("cache path:", "cache/" + fp + ".json")
print("check the file before any new fetch; articles never change")Expected: A content-addressed cache path. Briefing agents re-request the same top stories constantly; the cache absorbs it.
4. Spread polling across the day
import json
plan = {"poll_times_utc": ["06:00", "12:00", "18:00"], "per_poll_requests": 20}
open("poll_plan.json", "w").write(json.dumps(plan, indent=2))
print("3 polls per day, 20 requests each: well inside a standard quota")Expected: A poll schedule file. Steady small polls replace the briefing-time burst that trips the quota.
Other ways people phrase this
newsapi rate limited 429
The NewsAPI.org form. Its free tier is small; the cache plus schedule pattern fits it exactly.
news api quota exceeded request failed
Quota-shaped 429s need budget fixes, not retry fixes. Read headers, cache, schedule.
too many requests news api briefing
Briefing-time bursts are the usual cause. Spread the load across the day.
Why it happens
News APIs sell request quotas, and briefing agents that poll aggressively at briefing time burn the quota in minutes. The 429 is the meter working. Retrying hot just spends the remaining budget faster; the durable fix is spending fewer requests through caching and scheduling.
Edge cases
- Free tiers reset daily; a 429 near reset time just means waiting for the window.
- Some providers count failed requests against quota; validate params to avoid wasting calls on 400s.
- WebSocket or webhook push options avoid polling entirely on some providers.
- If two agents share one key, their combined usage trips the quota; split keys per agent.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_JrZYdeso4jm42IbGr3B2vg
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.