Skip to content

X post counts

$0.01 per callUSDC via x402POST /api/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 search operators (keywords, $cashtags, #hashtags, from:, lang:, -is:retweet). Send POST /api/x-post-counts with the required field query and pay $0.01 per call over x402 or MPP (there is no free tier). It returns a JSON object with source, fetchedAt, query, granularity, total and 3 more.

Returns the total and each bucket's start, end and count, plus a next_token when the window spans more buckets than one page holds. Counts only: no post text.

Category: Web & documentsTags: x twitter social x-api tweets counts volume mentions

Try in playground →

Parameters

NameTypeRequiredDescription
querystringyesX search query (max 512 chars). Supports X operators: from:user, #tag, $cashtag, lang:en, -is:retweet. Also accepted as q, search, term, keyword, question.
granularitystringnoBucket size: day (default), hour or minute.
start_timestringnoWindow start, ISO 8601 with a zone, within the last 7 days (default: 7 days ago).
end_timestringnoWindow end, ISO 8601 with a zone (default: now).
next_tokenstringnoPagination token from a previous response.

Example request

curl -i -X POST https://agent402.tools/api/x-post-counts \
  -H "Content-Type: application/json" \
  -d '{"query":"x402 -is:retweet","granularity":"day"}'

Without payment this returns HTTP 402 Payment Required with the exact price for x-post-counts; any x402 v2 or MPP client pays it and retries.

Watch a call get paid

RequestPOST /api/x-post-counts
402$0.01 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "source": "x-api-v2",
  "fetchedAt": "2026-11-20T14:10:00.000Z",
  "query": "x402 -is:retweet",
  "granularity": "day",
  "total": 102,
  "count": 2,
  "buckets": [
    {
      "start": "2026-11-18T00:00:00.000Z",
      "end": "2026-11-19T00:00:00.000Z",
      "count": 40
    },
    {
      "start": "2026-11-19T00:00:00.000Z",
      "end": "2026-11-20T00:00:00.000Z",
      "count": 62
    }
  ],
  "nextToken": null
}
FieldTypeAlways presentIn the example
sourcestringyesx-api-v2
fetchedAtstringyes2026-11-20T14:10:00.000Z
querystringyesx402 -is:retweet
granularitystringyesday
totalnumberyes102
countnumberyes2
bucketsarray of objectsyes2 items in the example
nextTokennullnonull

From an MCP client

catalog.call {
  "slug": "x-post-counts",
  "params": {
    "query": "x402 -is:retweet",
    "granularity": "day"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for x-post-counts; 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

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.01" }); // 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-post-counts", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "query": "x402 -is:retweet",
    "granularity": "day"
  }),
});

Related tools

X recent tweet search

$0.08POST /api/x-search-recent

Search public tweets from the last 7 days on X (Twitter) by query, using X API v2 search operators (keywords.

X trends by location

$0.02POST /api/x-trends

Read the current trending topics on X (Twitter) for one location by its WOEID (1 for worldwide, 23424977 for the United.

X tweet lookup

$0.008POST /api/x-tweet

Fetch one public tweet on X (Twitter) by id: text, created time, language, conversation id, engagement metrics (likes.

X user profile

$0.015POST /api/x-user

Look up one X (Twitter) account by username: id, display name, bio, account creation date, verification status and type.

X user timeline

$0.09POST /api/x-user-tweets

Fetch an X (Twitter) account's most recent tweets by user id or username (username is resolved first).

X bulk user lookup

$0.15POST /api/x-users-lookup

Look up up to 10 X (Twitter) accounts by username in one call.