# Track Google News results

`POST https://api.answerline.dev/v1/monitor/google/news`

Get structured articles from Google News: title, link, source and date for each.

From $0.50 per 1,000 requests. Failed requests are free. Also runs as an async task of type `GOOGLE_NEWS`.

## Body

- `query` (string, required): Query to run on Google News
- `country` (string): Country for localized news, as an ISO 3166-1 alpha-2 code. Google News publishes an edition in 71 countries, listed at https://answerline.dev/docs/coverage#countries; a request for another country is refused with a 400.
- `gl` (string): Google's own name for the result-geography parameter, usable in place of `country`. Takes ISO 3166-1 alpha-2 codes, as `country` does, in upper or lower case (`us` or `US`), and the country has to be one this endpoint supports (list them with `GET /v1/countries`; Google News has no `model` value there, and its edition countries are listed at https://answerline.dev/docs/coverage#countries). Send either `country` or `gl`; if both are sent with differing values, the request fails with `400`.
- `state` (string): US state code (e.g. "CA", "DC" included). Sent without a country, the request asks for the US; sent with any country other than "US", it is refused with a 400, uncharged. ChatGPT and Gemini answer as a person in that state sees it; every other engine accepts it and answers for the whole US, at the price of a request without it. provenance.requestedState reports the state asked. See https://answerline.dev/docs/coverage#states
- `hl` (string): Interface language, in the format of Google's `hl` parameter (for example `en`, `de`, `pt-BR`). Case-insensitive free text; Google defines which codes exist. Takes precedence over the language Answerline infers from the country, which lets interface language and result geography differ.
- `device` ("desktop" | "mobile" | "ios" | "android"): Device to run the search on. Not served for Google News yet: its results are read without a device, and a request that sets one is refused with a 400.
- `pages` (integer): How many pages of news results to request (1-10). The feed returns one list of articles, so more pages add no articles; they are charged as requested.
- `include` (object): Flags that add extra data to the response (optional)
  - `include.html` (boolean): A copy of the Google News feed the results were read from as it was when the answer was captured, stored on our file host and linked in `html`, to check the answer against. No extra cost.
  - `include.rawWire` (boolean): Return the engine's own response as received in result.rawWire: the answer stream, the rendered results pages or the RSS feed, without Gemini's detected location or ChatGPT's session tokens; null where it was not captured. Free. See https://answerline.dev/docs/output-formats#raw-wire
  - `include.screenshot` (boolean): Return a full-page PNG screenshot of the engine's page as it showed the finished answer, in result.screenshot: a link, or one link per results page on Google Search. On ChatGPT, Gemini, AI Mode, Google Search, Perplexity and Grok; other engines refuse it with a 400. Absent when the answer was read without a rendered page or its page was not available. Free. See https://answerline.dev/docs/output-formats#screenshots
- `answerDepth` ("any" | "full" | "quick"): Accepted so existing requests stay valid; it does not change the answer or the price. Every engine writes one depth: Perplexity answers every request with its Quick Search answer, and provenance.answerDepth says quick. See https://answerline.dev/docs/engine-features/#answer-depth

## Returns

- `result.newsResults` (object[]): Articles returned by Google News
- `result.html` (string[]): Present when include.html is true: the link to the stored copy of the Google News feed.

## Responses

- 200: Google News monitoring result (success)
- 400: Bad Request - one or more parameters are not valid
- 401: Unauthorized - API key absent or not valid
- 403: Forbidden - INSUFFICIENT_CREDITS: the balance does not cover this request
- 404: Not Found - No such route, or the engine is paused
- 409: Conflict - the resource is in a conflicting state
- 429: Too Many Requests - the call could not start now (`CONCURRENT_LIMIT_EXCEEDED`), or the service dropped the request because it was overloaded (`SERVICE_OVERLOADED`); that case returns `Retry-After` without any limit headers. `RATE_LIMIT_EXCEEDED`, with `Retry-After`, is sent only when one address presented too many unknown keys
- 499: Client Closed Request - the client cancelled the request
- 500: Internal Server Error
- 502: Bad Gateway - the engine failed

## Request

curl:

```bash
curl -X POST "https://api.answerline.dev/v1/monitor/google/news" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"electric vehicle battery","country":"FR","hl":"fr"}'
```

TypeScript:

```ts
import { Client } from "@answerline/sdk";

const client = new Client({ apiKey: process.env.API_KEY! });
const answer = await client.monitor.googleNews({
  "query": "electric vehicle battery",
  "country": "FR",
  "hl": "fr"
});
```

Python:

```python
import os
from answerline import Client

with Client(os.environ["API_KEY"]) as client:
    answer = client.monitor.google_news(
        query="electric vehicle battery",
        country="FR",
        hl="fr",
    )
```


## Example responses

200:

```json
{
  "success": true,
  "result": {
    "newsResults": [
      {
        "position": 1,
        "title": "Global Ocean Treaty Wins Final Ratification Vote",
        "link": "https://example.com/climate-summit-agreement",
        "snippet": "Central banks signaled further interest rate cuts this quarter...",
        "source": "The Guardian",
        "domain": "theguardian.com",
        "date": "2026-10-19T08:30:00.000Z",
        "page": 1,
        "thumbnail": "https://example.com/images/climate-summit.jpg",
        "redirectLink": "https://www.google.com/goto?url=CAESaAHrOzAVev0pi_wnTxm1qpiZTmMyAllabLr1or10ZCfvJKPk"
      }
    ],
    "html": [
      "https://files.answerline.dev/html/a12b3c4d-5e6f-47a8-9b0c-a1b2c3d4e5f6/1/page-1.html"
    ]
  }
}
```

400:

```json
{
  "success": false,
  "error": "Request validation failed",
  "details": [
    {
      "field": "prompt",
      "message": "Prompt must not be empty"
    }
  ]
}
```

502:

```json
{
  "error": {
    "code": "EXTERNAL_SERVICE_ERROR",
    "message": "External service error: the service failed",
    "details": {
      "service": "CHATGPT"
    },
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}
```

