X / Twitter API

X / Twitter Trends API

Get current X (Twitter) trends for worldwide, a country, or a city in X ranking order, including the resolved location.

POST/v1/run/twitter.trends
Uptime
100.00%
30d · 162 calls
Requests
166
30d · weekly, last 12 wks
Response
1.9s
median · 30d

Try it

Make your first request

requireFieldsarray
Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `promoted`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on a trend that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge.
Open in
Get a free key
Sample response
Free runs return only the first 3 results. Fund a key to get the full response.
{
  "data": {
    "asOfUtc": 12.5,
    "items": [
      {
        "isHashtag": true,
        "name": "Example title",
        "promoted": true,
        "query": "example",
        "rank": 1
      }
    ],
    "location": "example",
    "locationId": "a1b2c3d4"
  },
  "found": true
}
Response interface
interface TwitterTrendsResponse {
  data: {
    asOfUtc: number;
    items: {
      isHashtag?: boolean;
      name: string;
      promoted?: boolean;
      query: string;
      rank: number;
    }[];
    location: string;
    locationId: string;
  } | null;
  found: boolean;
}

Full parameter and response reference - every field, type, and example for this endpoint.

Reference

Request, response, and price

Last verified 2026-09-16 · uptime and latency measured over 30d
POST /v1/run/twitter.trends
curl -X POST https://api.getanyapi.com/v1/run/twitter.trends \
  -H "Authorization: Bearer $ANYAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit":10,"location":"US"}'
FieldTypeExample value
Request body
limitinteger10Maximum number of ranked trends to return (1-50, default 50).
locationstring"US"Country name, city name, or ISO country code. Omit for worldwide trends.
requireFieldsarrayOptional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `promoted`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on a trend that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge.
Response
dataobjectThe resolved location and its current ranked trends, or null when unavailable.
data.asOfUtcnumberUTC epoch timestamp in seconds (Unix time). Multiply by 1000 for a JS Date in milliseconds. Populated whenever the provider has data for the entity.
data.itemsobject[]Current trends in X's own ranking order. Distinct ranks may carry the same trend name. Populated whenever the provider has data for the entity.
data.items[].isHashtagcan requirebooleanWhether the trend text is a hashtag.
data.items[].namestringTrend text displayed by X. Populated whenever the provider has data for the entity.
data.items[].promotedcan requirebooleanWhether X marks the trend as promoted.
data.items[].querystringSearch query corresponding to the trend. Populated whenever the provider has data for the entity.
data.items[].rankintegerOne-based position in X's trend ranking. Populated whenever the provider has data for the entity.
data.locationstringResolved X trend-location name. Populated whenever the provider has data for the entity.
data.locationIdstringResolved Yahoo WOEID used by X, exposed as a stable location identifier. Populated whenever the provider has data for the entity.
foundbooleanWhether X trends were resolved for the requested location.
Price
Price per requestUSD$0.0001
Price /1k reqUSD$0.10

FAQ

About the X / Twitter Trends API

The AnyAPI X / Twitter Trends API returns X / Twitter trends data as normalized JSON from one POST call to /v1/run/twitter.trends. Get current X (Twitter) trends for worldwide, a country, or a city in X ranking order, including the resolved location. AnyAPI routes each request across 2 sources and falls back automatically when one fails. It costs from $0.10 per 1,000 requests, in US dollars with no subscription and no monthly minimum. Over the last 30 days, 100.0% of X / Twitter trends calls through AnyAPI succeeded, with a median response time of 1.9 seconds across 162 measured calls.

It costs from $0.10 per 1,000 requests, in US dollars with no subscription and no monthly minimum. You fund one USD wallet, each call draws it down, and a failed request costs $0.

Get current X (Twitter) trends for worldwide, a country, or a city in X ranking order, including the resolved location. The response is normalized JSON with the same envelope every AnyAPI endpoint returns, so parsing a second endpoint is a change of URL and nothing else.

Over the last 30 days, 100.0% of X / Twitter trends calls through AnyAPI succeeded, with a median response time of 1.9 seconds across 162 measured calls. These are AnyAPI's own measurements of traffic through the gateway, recomputed continuously, not a published service-level target.