• Home
  • Search
  • AI Services
  • Models
  • Writing
  • Multimedia Creation
  • Translation & Others
Home›Developer Center›Google News API

Google News API

API DocumentationAPI Quick StartOpenAI ChatGPT APIAnthropic (Claude) APIGoogle Gemini APIGoogle Search APIGoogle News APIOpenRouter APIAPI Pricing
CLI & Agent Guidescc-switch macOScc-switch Windowscc-switch LinuxOpenCode macOSOpenCode WindowsOpenCode LinuxOpenClaw macOSOpenClaw WindowsOpenClaw LinuxHermes Agent macOSHermes Agent WindowsHermes Agent LinuxClaude Code CLI macOSClaude Code CLI WindowsClaude Code CLI LinuxCodex CLI macOSCodex CLI WindowsCodex CLI Linux
MYAI168 API & MCPMYAI168 Chat API GuideMYAI168 MCP CLIMYAI168 MCP Web & App
User GuidesGT Agent GuideAI Services Guide
No matching questions on this page.Search the whole site
Google News search: endpoint, parameters and examples

Google News API

Query Google News articles by keyword and get structured JSON back (title, original article link, source outlet, publication time) — useful for news monitoring, digests, or giving an AI agent the latest coverage. For web search, see the Google Search API page.

  • Auth: an Authorization: Bearer YOUR_API_KEY header with your developer key (an X-Dev-Key header is also accepted), or a logged-in web session; never place keys in URL query strings (they end up in server logs).
  • Method: GET only, with every parameter in the query string.
  • Each call returns at most 20 articles; links are resolved to the original article URL when possible, otherwise the Google News redirect link is kept.
  • Successful calls deduct credits automatically; failed or empty searches are not charged.

GET https://www.myai168.com/en/api/google/news

ParameterRequiredDefaultDescription
qRequired—Search keywords (string); news search operators are allowed (see the next question). URL-encode it when it contains spaces, non-ASCII text or symbols.
hlOptionalen (by site language)Language of the news, e.g. en / zh-TW / ja.
glOptionalUS (by site language)Regional edition (country code, case-insensitive), e.g. US / TW / JP.
ceidOptionalDerived from gl and hlGoogle News edition code in "country:language" form (e.g. US:en, TW:zh-Hant). You normally leave it out; use it only for a special edition.
numOptional10Number of results, 1–20; out-of-range values are clamped and non-numeric values fall back to the default.

When hl, gl or ceid fails format validation the default is used instead (no error); the values that took effect are echoed in the response.

curl

curl -G "https://www.myai168.com/en/api/google/news" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "q=TSMC" \
  -d "hl=en" \
  -d "gl=us" \
  -d "num=5"

Python

import requests

r = requests.get(
    "https://www.myai168.com/en/api/google/news",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    params={"q": "TSMC", "hl": "en", "gl": "us", "num": 5},
    timeout=180,
)
r.raise_for_status()
data = r.json()
for item in data["results"]:
    print(item["date"], item["source"], item["title"], item["link"])
print("cost:", data["cost"], "credits:", data["credits"])

Node.js

Node.js 18+ has fetch built in; save the file as .mjs.

const params = new URLSearchParams({ q: "TSMC", hl: "en", gl: "us", num: "5" });
const res = await fetch("https://www.myai168.com/en/api/google/news?" + params, {
  headers: { Authorization: "Bearer YOUR_API_KEY" },
});
const data = await res.json();
if (!res.ok) throw new Error(data.error);
for (const item of data.results) console.log(item.date, item.source, item.title, item.link);
console.log("cost:", data.cost, "credits:", data.credits);

Resolving the original article URLs is done article by article, so a large num can take more than a minute; use a generous timeout (180 seconds in the example) or a smaller num.

Search syntax and regional editions (time conditions, outlets, country editions)

Search syntax and regional editions

The content of q is passed to Google News as is, so these operators narrow a search:

OperatorEffectExample (content of q)
when:Only recent coverage: when:1h one hour, when:1d one day, when:7d seven days.semiconductor when:1d
after: / before:A date range (YYYY-MM-DD).semiconductor after:2026-09-01 before:2026-09-30
site:Only a given news site.semiconductor site:reuters.com
intitle:The headline must contain the word.intitle:semiconductor
"..."Match the exact phrase."advanced packaging"
OR / -Match either term / exclude a term.TSMC OR Intel -stock

1. Only the past day

curl -G "https://www.myai168.com/en/api/google/news" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "q=semiconductor when:1d" \
  -d "num=10"

2. A single outlet, US English edition

curl -G "https://www.myai168.com/en/api/google/news" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "q=semiconductor site:reuters.com" \
  -d "hl=en" -d "gl=US"

Common regional editions

Passing hl and gl is enough; ceid is derived as shown:

EditionhlglDerived ceid
Taiwan (Traditional Chinese)zh-TWTWTW:zh-Hant
Hong Kong (Traditional Chinese)zh-HKHKHK:zh-Hant
United States (English)enUSUS:en
Japan (Japanese)jaJPJP:ja
China (Simplified Chinese)zh-CNCNCN:zh-Hans

Tips

  • For monitoring (polling the same keyword on a schedule) add a time condition such as when:1d and de-duplicate by link, so you do not keep receiving the same old articles.
  • When you only need a few headlines, lower num: the response is faster and uses fewer credits.
  • Always URL-encode keywords containing spaces, non-ASCII text, quotes or colons.
Response format, billing and error codes

Response format, billing and error codes

Success is HTTP 200 with a JSON object; the response headers also carry X-Cost-Points (credits charged) and X-Credits-Remaining (balance after the charge). Results keep the order Google News returned them in.

{
  "q": "TSMC",
  "hl": "en",
  "gl": "US",
  "ceid": "US:en",
  "num": 5,
  "count": 5,
  "results": [
    {"title": "...", "link": "https://example.com/news/123", "source": "Example News", "date": "Thu, 01 Oct 2026 08:30:00 GMT"}
  ],
  "cost": 12,
  "credits": 12345
}
FieldDescription
q / hl / gl / ceid / numThe query parameters that took effect (gl is always upper-cased).
countNumber of items in results.
results[].titleHeadline (with the trailing " - source" removed).
results[].linkThe original article URL; when it cannot be resolved, the Google News redirect link (starting with https://news.google.com/).
results[].sourceName of the source outlet.
results[].datePublication time in RFC 822 format (GMT), e.g. Thu, 01 Oct 2026 08:30:00 GMT; in Python parse it with email.utils.parsedate_to_datetime.
costCredits charged for this call (the number in the example is illustrative).
creditsBalance after the charge.

Billing

You are charged only when results come back, and the charge grows with the number of results returned; an empty search returns HTTP 200 with count 0 and cost 0. Errors are never charged.

Error codes

On errors the body is JSON with an error string field, for example:

{"error": "News search failed. Please try again later.", "q": "...", "cost": 0, "credits": 12345}
HTTP statusMeaning
400The q parameter is missing.
401Missing or invalid key (repeated failures from the same IP are temporarily blocked), or the key has reached its credit limit (API key credit limit reached!).
402Insufficient credits (You need to top up!); the search is not run.
404The external API is not enabled on this site.
405A method other than GET was used.
500The search service is not fully configured; contact the site administrator.
502The news search failed temporarily — never charged; the response also carries q, cost: 0 and credits.
‹ Previous page: Google Search APINext page: OpenRouter API ›
↑
Question link copied.

Other FAQ pages

API Documentation

  • API Quick Start
  • OpenAI ChatGPT API
  • Anthropic (Claude) API
  • Google Gemini API
  • Google Search API
  • OpenRouter API
  • API Pricing

CLI & Agent Guides

  • cc-switch macOS
  • cc-switch Windows
  • cc-switch Linux
  • OpenCode macOS
  • OpenCode Windows
  • OpenCode Linux
  • OpenClaw macOS
  • OpenClaw Windows
  • OpenClaw Linux
  • Hermes Agent macOS
  • Hermes Agent Windows
  • Hermes Agent Linux
  • Claude Code CLI macOS
  • Claude Code CLI Windows
  • Claude Code CLI Linux
  • Codex CLI macOS
  • Codex CLI Windows
  • Codex CLI Linux

MYAI168 API & MCP

  • MYAI168 Chat API Guide
  • MYAI168 MCP CLI
  • MYAI168 MCP Web & App

User Guides

  • GT Agent Guide
  • AI Services Guide