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

# Trends

> Find ranked X trends by WOEID region and search tweets from each topic

<blockquote className="agent-llms-directive">
  For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
</blockquote>

Xquik returns ranked X trends for 12 supported WOEID regions. Use each trend's
`query` with [Search Tweets](/api-reference/x/search-tweets) to collect matching
posts.

## Regions

Use these WOEIDs in `woeid` for `GET /trends` or `GET /x/trends`. Omit
`woeid` or pass `1` for worldwide trends.

<CardGroup cols={3}>
  <Card title="Global & Americas" icon="globe">
    * `1` - Worldwide
    * `23424977` - United States
    * `23424775` - Canada
    * `23424900` - Mexico
    * `23424768` - Brazil
  </Card>

  <Card title="Europe" icon="map-pin">
    * `23424975` - United Kingdom
    * `23424969` - Turkey
    * `23424950` - Spain
    * `23424829` - Germany
    * `23424819` - France
  </Card>

  <Card title="Asia" icon="building-2">
    * `23424856` - Japan
    * `23424848` - India
  </Card>
</CardGroup>

## How it works

When you call `GET /api/v1/trends`, Xquik fetches the latest trending topics
for the requested WOEID. Results are cached briefly to keep responses fast.

Each trend includes a `name`, optional `description`, optional `rank`, and
optional `query` string you can pass directly to [Search Tweets](/api-reference/x/search-tweets).

**Response:**

```json theme={null}
{
  "woeid": 23424977,
  "total": 30,
  "trends": [
    {
      "name": "#AI",
      "description": "Artificial Intelligence discussions",
      "rank": 1,
      "query": "#AI"
    }
  ]
}
```

The `count` query parameter controls how many trends to return. Defaults to
`30`; valid values are `1` through `50`.

## Combine trends with search

Fetch the top trend for a region, then search for tweets about it:

<CodeGroup>
  ```bash cURL theme={null}
  # 1. Get top trend
  TREND=$(curl -s "https://xquik.com/api/v1/trends?woeid=23424977&count=1" \
    -H "x-api-key: xq_YOUR_KEY_HERE" \
    | jq -r '.trends[0].query')

  # 2. Search tweets about it
  curl -G "https://xquik.com/api/v1/x/tweets/search" \
    --data-urlencode "q=$TREND" \
    -H "x-api-key: xq_YOUR_KEY_HERE" | jq
  ```

  ```javascript Node.js theme={null}
  const API_KEY = "xq_YOUR_KEY_HERE";
  const headers = { "x-api-key": API_KEY };

  // 1. Get top trend
  const trendsRes = await fetch("https://xquik.com/api/v1/trends?woeid=23424977&count=1", { headers });
  const trendsData = await trendsRes.json();
  const query = trendsData.trends[0].query;

  // 2. Search tweets about it
  const searchRes = await fetch(`https://xquik.com/api/v1/x/tweets/search?q=${encodeURIComponent(query)}`, { headers });
  const searchData = await searchRes.json();
  console.log(searchData);
  ```

  ```python Python theme={null}
  import requests

  API_KEY = "xq_YOUR_KEY_HERE"
  headers = {"x-api-key": API_KEY}

  # 1. Get top trend
  trends_res = requests.get(
      "https://xquik.com/api/v1/trends",
      params={"woeid": 23424977, "count": 1},
      headers=headers,
  )
  query = trends_res.json()["trends"][0]["query"]

  # 2. Search tweets about it
  search_res = requests.get(
      "https://xquik.com/api/v1/x/tweets/search",
      params={"q": query},
      headers=headers,
  )
  print(search_res.json())
  ```

  ```go Go theme={null}
  package main

  import (
  	"encoding/json"
  	"fmt"
  	"io"
  	"log"
  	"net/http"
  	"net/url"
  )

  const apiKey = "xq_YOUR_KEY_HERE"

  func main() {
  	// 1. Get top trend
  	req, err := http.NewRequest("GET", "https://xquik.com/api/v1/trends?woeid=23424977&count=1", nil)
  	if err != nil {
  		log.Fatal(err)
  	}
  	req.Header.Set("x-api-key", apiKey)

  	resp, err := http.DefaultClient.Do(req)
  	if err != nil {
  		log.Fatal(err)
  	}
  	defer resp.Body.Close()

  	body, err := io.ReadAll(resp.Body)
  	if err != nil {
  		log.Fatal(err)
  	}

  	var trends struct {
  		Trends []struct {
  			Query string `json:"query"`
  		} `json:"trends"`
  	}
  	json.Unmarshal(body, &trends)

  	// 2. Search tweets about it
  	searchURL := "https://xquik.com/api/v1/x/tweets/search?q=" + url.QueryEscape(trends.Trends[0].Query)
  	req2, err := http.NewRequest("GET", searchURL, nil)
  	if err != nil {
  		log.Fatal(err)
  	}
  	req2.Header.Set("x-api-key", apiKey)

  	resp2, err := http.DefaultClient.Do(req2)
  	if err != nil {
  		log.Fatal(err)
  	}
  	defer resp2.Body.Close()

  	body2, err := io.ReadAll(resp2.Body)
  	if err != nil {
  		log.Fatal(err)
  	}
  	fmt.Println(string(body2))
  }
  ```
</CodeGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Trends API Reference" icon="trending-up" href="/api-reference/trends/list">
    Full endpoint reference with query parameters and response schema.
  </Card>

  <Card title="Billing & Usage" icon="credit-card" href="/guides/billing">
    Subscription pricing, credits, and per-operation costs.
  </Card>
</CardGroup>
