Google News API
Query Google News and receive structured, real-time news headlines with source and timestamp.
Endpoint
POST https://serpforai.dev/api/v1/search
GET https://serpforai.dev/api/v1/search
Authentication is a bearer header carrying your API key:
Authorization: Bearer <userKey>
Set t: "google_news". This is one of five Google vertical engines available on this API - see
also Google Images, Google Shopping,
Google Videos and Google Short Videos.
For general web search use the SERP API.
Request parameters
POST requests send JSON; GET requests send the same fields as query parameters.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
s | string | yes | - | The search keyword |
t | string | yes | - | Must be google_news |
d | number | no | 5000 | Maximum time the API may spend, in milliseconds |
country | string | no | - | ISO 3166-1 alpha-2 country code (e.g. us) |
html | number | no | 0 | 1 includes the raw result-page HTML alongside data, 0 omits it |
There is no p (page) parameter for this engine.
Response
{
"code": 0,
"msg": "",
"data": {
"id": "q_...",
"news_results": [
{
"position": 1,
"title": "...",
"source": { "name": "Example News" },
"link": "https://...",
"date": "3 hours ago",
"iso_date": "2024-01-01T00:00:00.000Z",
"snippet": "..."
}
]
}
}
| Field | Description |
|---|---|
code | 0 means success; anything else is a failure |
msg | Human readable failure reason, empty on success |
data.id | Opaque search-session id |
data.news_results[] | News rows - position, title, source.name, link, date, iso_date, snippet |
Unlike bing/google, data here is an object, not a bare array - read
data.news_results, not data directly. Prefer iso_date over the human-readable date string
for sorting or freshness checks.
Example
curl -X POST https://serpforai.dev/api/v1/search \
-H "Authorization: Bearer $SERPFORAI_KEY" \
-H "Content-Type: application/json" \
-d '{"s":"ai regulation","t":"google_news","country":"us"}'
import httpx
response = httpx.post(
"https://serpforai.dev/api/v1/search",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"s": "ai regulation", "t": "google_news", "country": "us"},
timeout=30,
)
payload = response.json()
for row in payload["data"]["news_results"]:
print(row["title"], row["source"]["name"])