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

# Twitter trend locations API with WOEID list

> List the places X offers trends for. Get each WOEID, name, country, country code, and place type, then send a WOEID to the trends API. 1 credit per location.

<Panel>
  <Tabs defaultTabIndex={0} sync={false}>
    <Tab title="200" id="response-x-trend-locations-200">
      ```json theme={null}
      {
        "locations": [
          {
            "woeid": 2344116,
            "name": "Istanbul",
            "country": "Turkey",
            "countryCode": "TR",
            "placeType": "Town"
          }
        ],
        "count": 1,
        "total": 1
      }
      ```
    </Tab>

    <Tab title="401" id="response-x-trend-locations-401">
      ```json theme={null}
      {
        "error": "unauthenticated",
        "message": "Authentication required."
      }
      ```
    </Tab>

    <Tab title="402" id="response-x-trend-locations-402">
      ```json theme={null}
      {
        "error": "insufficient_credits",
        "message": "Insufficient credits. Top up or subscribe to continue."
      }
      ```
    </Tab>

    <Tab title="424" id="response-x-trend-locations-424">
      ```json theme={null}
      {
        "error": "x_api_unavailable",
        "message": "X data source temporarily unavailable. Try again later."
      }
      ```
    </Tab>

    <Tab title="429" id="response-x-trend-locations-429">
      ```json theme={null}
      {
        "error": "rate_limit_exceeded",
        "message": "Too many requests. Try again later.",
        "retryAfter": 60
      }
      ```
    </Tab>

    <Tab title="502" id="response-x-trend-locations-502">
      ```json theme={null}
      {
        "error": "x_api_unavailable",
        "message": "X data source temporarily unavailable. Try again later."
      }
      ```
    </Tab>

    <Tab title="503" id="response-x-trend-locations-503">
      ```json theme={null}
      {
        "error": "x_api_unavailable",
        "message": "Xquik is busy right now. Retry shortly."
      }
      ```
    </Tab>
  </Tabs>
</Panel>

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

<Callout icon="coins" color="#5c3327">
  **1 credit per location returned** · [All plans](https://xquik.com/#pricing) from \$0.00012/credit
</Callout>

<CodeGroup>
  ```bash cURL theme={null}
  curl -G https://xquik.com/api/v1/x/trends/locations \
    --data-urlencode "country=TR" \
    --data-urlencode "placeType=town" \
    -H "x-api-key: xq_your_api_key_here" | jq
  ```

  ```javascript Node.js theme={null}
  const params = new URLSearchParams({ country: "TR", placeType: "town" });
  const response = await fetch(`https://xquik.com/api/v1/x/trends/locations?${params}`, {
    headers: { "x-api-key": "xq_your_api_key_here" },
  });
  const data = await response.json();
  const locationRows = data.locations.map((location) => ({
    woeid: location.woeid,
    name: location.name,
    country_code: location.countryCode,
    place_type: location.placeType,
  }));

  for (const row of locationRows) {
    process.stdout.write(`${JSON.stringify(row)}\n`);
  }
  ```

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

  response = requests.get(
      "https://xquik.com/api/v1/x/trends/locations",
      params={"country": "TR", "placeType": "town"},
      headers={"x-api-key": "xq_your_api_key_here"},
  )
  data = response.json()
  location_rows = [
      {
          "woeid": location["woeid"],
          "name": location["name"],
          "country_code": location["countryCode"],
          "place_type": location["placeType"],
      }
      for location in data["locations"]
  ]
  for row in location_rows:
      print(json.dumps(row))
  ```
</CodeGroup>

Use `GET /x/trends/locations` to list the places X offers trends for.
Each location carries the `woeid` that [Get X trends](/api-reference/x/trends) takes.
Each returned location costs 1 credit. Filters and `limit` lower the cost.
An empty result costs nothing.

## Find a WOEID before you read trends

Call this endpoint once and store the list. X changes it rarely.
Filter by `country` to get a country and its towns in 1 call.
Filter by `placeType` to get only countries or only towns.
Use `q` when you know part of a place name.

Pass the `woeid` of a location to `GET /x/trends` as `woeid`.
You can also pass its `name` as `location`, or a country as `country`.
Worldwide has `woeid` 1, with no country and no parent.

## Query parameters

<ParamField query="country" type="string">
  Country name or 2-letter code, such as `Turkey` or `TR`. Case insensitive. Returns the country and its towns.
</ParamField>

<ParamField query="placeType" type="string">
  Kind of place: `country`, `town`, `worldwide`, or `unknown`. Case insensitive. X labels a few towns `unknown`.
</ParamField>

<ParamField query="q" type="string">
  Text the location name contains, such as `york`. Case insensitive. Alias: `query`.
</ParamField>

<ParamField query="limit" type="integer">
  Maximum locations to return, starting at `1`. Omit it for every match. Your credit balance can return fewer. Aliases: `pageSize`, `count`, `max_results`, `maxItems`, `max_items` & `per_page`.
</ParamField>

## Headers

<ParamField header="x-api-key" type="string">
  Send a full Xquik account API key.
</ParamField>

<ParamField header="Authorization" type="string">
  `Bearer xq_your_guest_key_here` for `paid_reads`.
</ParamField>

## Response

### 200 OK

<ResponseField name="locations" type="object[]">
  Locations that match your filters, in X's order.
  **Location object fields.**

  <ResponseField name="woeid" type="number">
    Location ID. Pass it as `woeid` to `GET /x/trends`.
  </ResponseField>

  <ResponseField name="name" type="string">
    Place name.
  </ResponseField>

  <ResponseField name="country" type="string | null">
    Country name. Null for Worldwide.
  </ResponseField>

  <ResponseField name="countryCode" type="string | null">
    2-letter country code. Null for Worldwide.
  </ResponseField>

  <ResponseField name="placeType" type="string | null">
    X's kind of place: `Town`, `Country`, `Supername` for Worldwide, or `Unknown`.
  </ResponseField>

  <ResponseField name="placeTypeCode" type="number | null">
    X's numeric code for the kind of place.
  </ResponseField>

  <ResponseField name="parentWoeid" type="number | null">
    WOEID of the country or region above it. Null for Worldwide.
  </ResponseField>

  <ResponseField name="url" type="string | null">
    X's legacy Yahoo GeoPlanet reference. It may not resolve.
  </ResponseField>
</ResponseField>

<ResponseField name="count" type="number">Locations returned and charged.</ResponseField>
<ResponseField name="total" type="number">Locations that match the filters, before `limit`.</ResponseField>

<ResponseField name="message" type="string">
  What to send instead. Present only when no location matches.
</ResponseField>

```json theme={null}
{
  "locations": [
    {
      "woeid": 2344116,
      "name": "Istanbul",
      "country": "Turkey",
      "countryCode": "TR",
      "placeType": "Town",
      "placeTypeCode": 7,
      "parentWoeid": 23424969,
      "url": "http://where.yahooapis.com/v1/place/2344116"
    }
  ],
  "count": 1,
  "total": 1
}
```

A filter value that matches no location returns an empty list and a `message`:

```json theme={null}
{
  "locations": [],
  "count": 0,
  "total": 0,
  "message": "Unknown placeType. Use country, town, worldwide or unknown."
}
```

### 401 Unauthenticated

Anonymous requests get `WWW-Authenticate: Bearer` and a guest wallet checkout action. This is not a Payment challenge.

```json theme={null}
{ "error": "unauthenticated" }
```

### 402 Payment required

Account keys get account options. Guest keys get guest top-up only.
No checkout starts automatically. Confirm any payment action.

### 502 X API unavailable

```json theme={null}
{ "error": "x_api_unavailable" }
```

The read service returned an error. Retry after a short delay.

### 503 Service busy

```json theme={null}
{ "error": "x_api_unavailable" }
```

Xquik is busy. Wait for `Retry-After`, then retry.

### 429 Rate limit exceeded

```json theme={null}
{ "error": "rate_limit_exceeded", "retryAfter": 60 }
```

The Xquik tier limit blocked the request.
Use `Retry-After` when present. Otherwise, use the JSON `retryAfter` field.

### 424 Dependency failed

```json theme={null}
{ "error": "x_api_unavailable" }
```

The opt-in normalized contract returns 424 when the read service fails.
Send `xquik-api-contract: 2026-04-29` to opt in. Default v1 returns 502.

## Twitter trend locations API questions

### How do I get a list of Twitter trend locations?

Call `GET /x/trends/locations` without filters.
The response lists every place X offers trends for, with its WOEID.

### How do I find the WOEID of a city or country?

Send `q` with part of the name, or `country` with a name or 2-letter code.
Read `woeid` from the matching location.

### How much does a trend locations request cost?

Each returned location costs 1 credit. An empty result costs nothing.
Add `limit` or a filter to return fewer locations.

### What does an unknown filter value return?

It returns an empty `locations` list and a `message` that says what to send.
The request costs nothing.

### Does this replace X's official API?

No. This page documents Xquik, an independent third-party service.
It does not document X's official API.

<Note>
  **Next steps.** [Get X trends](/api-reference/x/trends) reads the trends of a location by its `woeid` or its name.
</Note>

<div className="related-api-links">
  <Accordion title="Related tweet, reply & media APIs" icon="link">
    * Tweets: [Get tweet](/api-reference/x/get-tweet) · [Batch tweets](/api-reference/x/batch-tweets) · [Tweet thread](/api-reference/x/tweet-thread) · [Hidden replies](/api-reference/x/tweet-hidden-replies) · [Translate tweet](/api-reference/x/tweet-translation) · [Embed tweet](/api-reference/x/tweet-embed) · [Resolve links](/api-reference/x/resolve-links) · [Tweet subtitles](/api-reference/x/tweet-subtitles) · [X Article](/api-reference/x/get-article)
    * Engagement: [Tweet replies](/api-reference/x/tweet-replies) · [Quote tweets](/api-reference/x/tweet-quotes) · [Likers](/api-reference/x/favoriters) · [Reposters](/api-reference/x/retweeters) · [Check repost](/api-reference/x/tweet-repost-check)
    * Profiles: [User tweets](/api-reference/x/user-tweets) · [Batch user tweets](/api-reference/x/batch-user-tweets) · [User replies](/api-reference/x/user-replies) · [User likes](/api-reference/x/user-likes) · [User media](/api-reference/x/user-media) · [User highlights](/api-reference/x/user-highlights) · [User articles](/api-reference/x/user-articles)
    * Feeds: [List tweets](/api-reference/x/list-tweets) · [Trends](/api-reference/x/trends) · [Trend locations](/api-reference/x/trend-locations) · [Search Spaces](/api-reference/x/search-spaces) · [Get Space](/api-reference/x/get-space) · [Space replay](/api-reference/x/space-replay) · [Get broadcast](/api-reference/x/get-broadcast) · [Hashflags](/api-reference/x/hashflags) · [Search places](/api-reference/x/search-places) · [Download media](/api-reference/x/download-media)
  </Accordion>
</div>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.