Guardian headlines by section or tag
The latest stories (up to about 100, newest first) of any Guardian section, topic tag, series or contributor page: headline, standfirst, link, publication time, byline, section, type (article, liveblog, video, audio, gallery), topic tags with their paths and image. Filter by keywords and since a time. With page, any numbered page of the listing (20 stories a page, back through the archive) instead, with page, last_page, total and next_page; on topic, series and contributor pages each story also has trail_text, thumbnail, pillar (News, Opinion, Sport, Arts, Lifestyle), design, series, is_live, commentable and short_url (section fronts give headline, link, time and image). Article bodies are not returned (use /guardian/v1/article).
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
section | string | A section or tag path as in the site's addresses: international (default), uk, us, au, world, uk-news, us-news, politics, business, technology, science, environment, sport, football, culture, lifeandstyle, commentisfree, a topic tag such as technology/artificialintelligenceai, a series, or profile/<contributor>. Example: technology/artificialintelligenceai |
q | string | Only stories whose headline or standfirst contains all these words. |
since | string | Only stories published at or after this date or ISO time. |
limit | integer | Maximum stories (default 50, max 100). |
page | integer | A page number of the listing, 1 = newest (20 stories a page). Pass next_page from the previous response. Without it, the latest stories are returned. |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/guardian/v1/headlines?section=technology%2Fartificialintelligenceai" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/guardian/v1/headlines",
params={"section": "technology/artificialintelligenceai"},
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/guardian/v1/headlines");
url.searchParams.set("section", "technology/artificialintelligenceai");
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).