> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# NewsClient

> Methods for X API v2 News endpoints.

Access **News** endpoints via `client.news` (`NewsClient`).

## Methods

| Method | Endpoint | Behavior | Summary |
| :- | :- | :- | :- |
| [`get`](#get) | `GET /2/news/{id}` | Standard | Get News Stories by ID |
| [`search`](#search) | `GET /2/news/search` | Standard | Search News |

## `get`

GET `/2/news/{id}`

**Get News Stories by ID**

Retrieves news story by its ID.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.news.get(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Optional keyword arguments (1)**

**news\_fields** `Array\<String\>`

A comma separated list of News fields to display.

**Returns:** `Hash`

***

## `search`

GET `/2/news/search`

**Search News**

Retrieves a list of News stories matching the specified search query.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.news.search(query: "from:XDevelopers")
puts response
```

### Parameters

**query** `String` *required*

`query` (query parameter).

**Optional keyword arguments (3)**

**max\_results** `Integer`

`max_results` (query parameter).

**max\_age\_hours** `Integer`

`max_age_hours` (query parameter).

**news\_fields** `Array\<String\>`

A comma separated list of News fields to display.

**Returns:** `Hash`

***
