CNN headlines of the last two days
Everything CNN published in the last two days (usually 200+ stories), newest first: headline, link, publication and update times, section, type (article, video, live updates, gallery, interactive), keywords and image, with section, type, keyword and time filters. sections_available lists the sections present now. With month (and section), the stories of that section in that month instead, from CNN's monthly archive going back years: link, publication date (from the link), last update, lead image with image_caption, and a title read from the link (the archive carries no headline or keywords). Article bodies are not returned.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
section | string | Section as in CNN's addresses: politics, world, us, business, economy, markets, health, entertainment, sport, style, travel, climate, weather, science, media, tech... Required with month. Example: politics |
type | article | video | live | gallery | interactive | Story type. |
q | string | Only stories whose headline or keywords (with month: title or image caption) contain all these words. |
since | string | Only stories published at or after this date or ISO time. |
month | string | YYYY-MM: that month's stories of section from CNN's archive instead of the last two days. |
limit | integer | Maximum stories (default 50, max 300). |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/cnn/v1/headlines?section=politics" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/cnn/v1/headlines",
params={"section": "politics"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/cnn/v1/headlines");
url.searchParams.set("section", "politics");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).