Guardian article
One Guardian article by its link: headline, standfirst, trail text, byline and authors (profile link, picture, X handle), first-published and update times, section, pillar, type, topic tags, main image or video, and the full text as ordered blocks (paragraphs, headings, lists, quotes, inline images with caption and credit, embeds), plus the related links shown in the article. Live blogs also return their latest updates (time, title, key-event and pinned flags, text) and key events. latest=true with section opens the newest article of a section.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
url | string | A theguardian.com article link (…/<section>/<yyyy>/<mon>/<dd>/<slug>), or that path alone. Example: https://www.theguardian.com/world/2013/jun/06/nsa-phone-records-verizon-court-order |
latest | boolean | true opens the newest article of section instead of url. |
section | string | With latest=true: a section or tag path as in /guardian/v1/headlines (default international). |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/guardian/v1/article?url=https%3A%2F%2Fwww.theguardian.com%2Fworld%2F2013%2Fjun%2F06%2Fnsa-phone-records-verizon-court-order" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/guardian/v1/article",
params={"url": "https://www.theguardian.com/world/2013/jun/06/nsa-phone-records-verizon-court-order"},
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/article");
url.searchParams.set("url", "https://www.theguardian.com/world/2013/jun/06/nsa-phone-records-verizon-court-order");
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).