Skip to content

Trend Locations

GET/tw-v2/trends/locations

1 API unit per call · How billing works

Description

List the locations X serves trends for, with the WOEID to pass to /tw-v2/trends.

Usage notes

The list covers worldwide, a set of countries and many cities. It is not every country. For country trends, pass the countryCode of a Country entry as country to /tw-v2/trends; city entries also carry a country code, so check the place type. For city trends, pass the WOEID instead. Locations keep X's order. placeType.name is Supername for worldwide, Country for countries and Town for cities; a few other place types also appear. The response is not paginated.

A request costs one API unit. 400, 401, 403, 429 and 5xx errors are free; a 404 is billed.

Query Parameters

This endpoint takes no parameters.

Code Examples

const response = await fetch('https://api.tweetapi.com/tw-v2/trends/locations', {
  method: 'GET',
  headers: {
    'X-API-Key': 'YOUR_API_KEY'
  }
});

const data = await response.json();
console.log(data);

Response

Success Response (200 OK)

Synthetic example:

200
{
  "data": [
    {
      "woeid": 1,
      "name": "Worldwide",
      "placeType": {
        "code": 19,
        "name": "Supername"
      },
      "country": null,
      "countryCode": null,
      "parentId": null
    },
    {
      "woeid": 23424977,
      "name": "United States",
      "placeType": {
        "code": 12,
        "name": "Country"
      },
      "country": "United States",
      "countryCode": "US",
      "parentId": 1
    },
    {
      "woeid": 2972,
      "name": "Winnipeg",
      "placeType": {
        "code": 7,
        "name": "Town"
      },
      "country": "Canada",
      "countryCode": "CA",
      "parentId": 23424775
    }
  ]
}

Synthetic excerpt; the real list has several hundred locations.

Errors

Errors return { statusCode, message } with a non-2xx HTTP status.

An unexpected 404 from X or a malformed location response returns 502. Other errors from X retain their HTTP status, such as 429 for a rate limit or 503 for temporary unavailability. These errors are not billed.

400
{
  "statusCode": 400,
  "message": "Request validation failed"
}

TweetAPI is a third-party API and is not affiliated with X Corp.