> ## 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.

# TrendsClient

> Methods for X API v2 Trends endpoints.

Access **Trends** endpoints via `client.trends()` (`TrendsClient`).

## Methods

| Method | Endpoint | Behavior | Summary |
| :- | :- | :- | :- |
| [`getByWoeid`](#getbywoeid) | `GET /2/trends/by/woeid/{woeid}` | Standard | Get Trends by WOEID |
| [`getLocations`](#getlocations) | `GET /2/trends/locations` | Standard | Get Trend Locations |
| [`getPersonalized`](#getpersonalized) | `GET /2/users/personalized_trends` | Standard | Get Personalized Trends |

## `getByWoeid`

GET `/2/trends/by/woeid/{woeid}`

**Get Trends by WOEID**

Retrieves trending topics for a specific location identified by its WOEID. `meta.location` describes that location: its `woeid` and `name`, and when they are known its `country`, `country_code`, `place_type` (`town`, `country` or `supername`) and `parent_id`, the WOEID of the place that contains it.

```java theme={null}
import com.x.xdk.XClient;

XClient client = XClient.builder()
    .bearerToken(System.getenv("X_BEARER_TOKEN"))
    .build();

var response = client.trends().getByWoeid(1);
System.out.println(response);
```

### Parameters

**woeid** `Integer` *required*

`woeid` (path parameter).

**Optional parameters (TrendsClient.GetByWoeidOptions — 2)**

**options.maxTrends** `Integer`

`max_trends` (query parameter).

**options.trendFields** `List\<String\>`

A comma separated list of Trend fields to display.

**Returns:** `Schemas.GetTrendsByWoeidResponse`

***

## `getLocations`

GET `/2/trends/locations`

**Get Trend Locations**

Retrieves every location that has trends. Each location has a WOEID to pass to `GET /2/trends/by/woeid/{woeid}`. The list is short and is returned whole, so the route takes no paging parameters.

```java theme={null}
import com.x.xdk.XClient;

XClient client = XClient.builder()
    .bearerToken(System.getenv("X_BEARER_TOKEN"))
    .build();

var response = client.trends().getLocations();
System.out.println(response);
```

### Parameters

**Optional parameters (TrendsClient.GetLocationsOptions — 1)**

**options.trendLocationFields** `List\<String\>`

A comma separated list of TrendLocation fields to display.

**Returns:** `Schemas.GetTrendsLocationsResponse`

***

## `getPersonalized`

GET `/2/users/personalized_trends`

**Get Personalized Trends**

Retrieves personalized trending topics for the authenticated user.

```java theme={null}
import com.x.xdk.XClient;

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.trends().getPersonalized();
System.out.println(response);
```

### Parameters

**Optional parameters (TrendsClient.GetPersonalizedOptions — 1)**

**options.personalizedTrendFields** `List\<String\>`

A comma separated list of PersonalizedTrend fields to display.

**Returns:** `Schemas.GetTrendsPersonalizedTrendsResponse`

***
