X trends by location
POST /api/x-trendsRead the current trending topics on X (Twitter) for one location by its WOEID (1 for worldwide, 23424977 for the United States, 44418 for London): up to 50 trends with each trend's name and its post count where X reports one, plus the location's name, country and place type. Send POST /api/x-trends with the required field woeid and pay $0.02 per call over x402 or MPP (there is no free tier). It returns a JSON object with source, fetchedAt, woeid, location, count and 1 more.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
woeid | number | yes | Yahoo Where On Earth id of the location: 1 worldwide, 23424977 United States, 44418 London. |
max_trends | number | no | Trends to return, 1-50 (default 20). |
Example request
curl -i -X POST https://agent402.tools/api/x-trends \
-H "Content-Type: application/json" \
-d '{"woeid":23424977,"max_trends":10}'Without payment this returns HTTP 402 Payment Required with the exact price for x-trends; any x402 v2 or MPP client pays it and retries.
Watch a call get paid
POST /api/x-trends$0.02 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example response
{
"source": "x-api-v2",
"fetchedAt": "2026-11-20T14:10:00.000Z",
"woeid": 23424977,
"location": {
"woeid": 23424977,
"name": "United States",
"country": "United States",
"countryCode": "US",
"placeType": "country"
},
"count": 2,
"trends": [
{
"name": "#Thanksgiving",
"postCount": 184000
},
{
"name": "Stablecoins",
"postCount": null
}
]
}| Field | Type | Always present | In the example |
|---|---|---|---|
source | string | yes | x-api-v2 |
fetchedAt | string | yes | 2026-11-20T14:10:00.000Z |
woeid | number | yes | 23424977 |
location | object | yes | 5 fields: woeid, name, country, countryCode, placeType |
count | number | yes | 2 |
trends | array of objects | yes | 2 items in the example |
From an MCP client
catalog.call {
"slug": "x-trends",
"params": {
"woeid": 23424977,
"max_trends": 10
}
}The hosted connector at https://agent402.tools/mcp needs a payment for x-trends; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.14.1.
Errors and behavior
woeidis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement runs after the tool and only on a successful response. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
GETorHEADto /api/x-trends returns the same 402 quote, so the price can be read without a body. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.02" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/x-trends", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"woeid": 23424977,
"max_trends": 10
}),
});Related tools
X post counts
Count public posts on X (Twitter) matching a query over the last 7 days, bucketed by day, hour or minute, using X API v2.
X recent tweet search
Search public tweets from the last 7 days on X (Twitter) by query, using X API v2 search operators (keywords.
X tweet lookup
Fetch one public tweet on X (Twitter) by id: text, created time, language, conversation id, engagement metrics (likes.
X user profile
Look up one X (Twitter) account by username: id, display name, bio, account creation date, verification status and type.
X user timeline
Fetch an X (Twitter) account's most recent tweets by user id or username (username is resolved first).
X bulk user lookup
Look up up to 10 X (Twitter) accounts by username in one call.