# Chat with Internet News

### Endpoint

```
POST /v1/news/google_news_chat
```

[**Try it out in API Playground →**](https://api.orbitfin.ai/docs#/default/google_news_chat_answer_v1_news_google_news_chat_post)

### Request

#### Headers

| Name           | Type   | Required | Description        |
| -------------- | ------ | -------- | ------------------ |
| `Content-Type` | string | Yes      | `application/json` |
| `X-API-KEY`    | string | Yes      | your-api-key       |

#### Request Body Parameters

| Parameter        | Type   | Required | Description                                                                              |
| ---------------- | ------ | -------- | ---------------------------------------------------------------------------------------- |
| `keywords`       | string | Yes      | Comma-separated keywords to filter news articles (e.g., "revenue,growth,latest quarter") |
| `start_date`     | string | Yes      | Start date for news search in `YYYY-MM-DD` format (e.g., "2024-12-01")                   |
| `end_date`       | string | Yes      | End date for news search in `YYYY-MM-DD` format (e.g., "2024-12-08")                     |
| `language`       | string | Yes      | ISO 639-1 language code for news content (default: "en")                                 |
| `searchQuestion` | string | Yes      | Natural language question or prompt to analyze the retrieved news articles               |

#### Example Request

```bash
curl -X 'POST' \
  'https://api.orbitfin.ai/v1/news/google_news_chat' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: <your-api-key>' \
  -H 'Content-Type: application/json' \
  -d '{
  "start_date": "2025-05-13",
  "end_date": "2025-05-20",
  "searchQuestion": "Identify all Daimler Truck presentation appendices or supplementary slides titled '\''KPI annex'\'' or '\''reconciliation tables'\'' from investor relations documents dated between Q2 2024 and Q2 2025. Provide document titles and dates.",
  "keywords": "revenue,growth,latest quarter",
  "language": "en"
}'
```

### Response

#### Response Fields

**Top-Level Fields**

| Field         | Type        | Description                                                |
| ------------- | ----------- | ---------------------------------------------------------- |
| `status_code` | integer     | HTTP status code (200 for success)                         |
| `data`        | object      | Response object containing chat answer and source articles |
| `detail`      | string/null | Additional error details (null on success)                 |
| `message`     | string      | Response status message                                    |

**Data Object**

| Field     | Type   | Description                                                           |
| --------- | ------ | --------------------------------------------------------------------- |
| `answer`  | string | AI-generated response to your search question based on retrieved news |
| `sources` | array  | Array of news article objects used to generate the answer             |

**News Article Object (`sources[]`)**

| Field       | Type        | Description                                                     |
| ----------- | ----------- | --------------------------------------------------------------- |
| `date`      | string      | Publication date of the news article (format: "Month DD, YYYY") |
| `link`      | string      | Direct URL to the original news article                         |
| `title`     | string      | Headline or title of the news article                           |
| `source`    | string/null | News source or publisher name (null if unavailable)             |
| `snippet`   | string      | Brief excerpt or summary of the article content                 |
| `position`  | integer     | Ranking position in search results (1-based index)              |
| `thumbnail` | string      | URL to the article's thumbnail image                            |

#### Example Response

```json
{
  "status_code": 200,
  "data": {
    "answer": "Based on the retrieved news articles from May 13-20, 2025, I found the following relevant information about Daimler Truck investor relations documents:\n\nWhile the search results include various quarterly earnings reports, I did not find specific documents titled 'KPI annex' or 'reconciliation tables' for Daimler Truck in the specified timeframe. However, The Home Depot's Q1 2025 results (May 20, 2025) show strong revenue growth of 9.4%, which may be relevant to your broader market analysis.",
    "sources": [
      {
        "date": "May 20, 2025",
        "link": "https://ir.homedepot.com/news-releases/2025/05-20-2025-110127912",
        "title": "The Home Depot Announces First Quarter Fiscal 2025 Results; Reaffirms Fiscal 2025 Guidance",
        "source": "Home Depot Investor Relations",
        "snippet": "The Home Depot, the world's largest home improvement retailer, today reported sales of $39.9 billion for the first quarter of fiscal 2025, an increase of 9.4%...",
        "position": 1,
        "thumbnail": "https://ot-cdn.s3.us-west-2.amazonaws.com/google_news_history_chat/20250513_None_tnHZflkS.png"
      }
    ]
  },
  "detail": null,
  "message": "success"
}
```

### Error Handling

All endpoints follow the standard error response format. When an error occurs, the API returns an appropriate HTTP status code along with a structured error response.

For detailed information about error codes, response formats, and troubleshooting guidelines, please refer to **Appendix A: Error Code Reference**.
