Use case
Social listening and brand monitoring with an API
GET /v1/x/search/tweets for keyword searches, /v1/x/users/{handle}/mentions for posts that mention an account, and the replies and quotes endpoints for a single post. Each live call costs 2 credits, so 1,000 checks cost 2,000 credits.Updated by the Handles API team
The four endpoints behind a listening loop
A brand monitor on X needs four reads: a keyword search, the mentions of your account, the replies to one post and the quote posts of one post. All four are live X reads at 2 credits per call and share one post format.
| Endpoint | What it finds | Credits |
|---|---|---|
| GET /v1/x/search/tweets | Posts matching X advanced search, with operators such as from:, to:, since:, until:, filter:, min_faves: and lang: | 2 |
| GET /v1/x/users/{handle}/mentions | Posts that mention an account, newest first, with the account's own posts left out | 2 |
| GET /v1/x/tweets/{id}/replies | Direct replies to one post | 2 |
| GET /v1/x/tweets/{id}/quotes | Quote posts of one post | 2 |
scrape:live scope. It is a sensitive scope, it is not granted to keys by default, and calls made with it are audited. See authentication and keep the key on your server.Writing brand queries with X advanced search
The search endpoint passes your query to X advanced search unchanged, so any operator that works in the X search box works here. A good brand query names the brand, removes your own posts and limits the language.
"Example Co" -from:exampleco lang:enfinds English posts that name the brand and skips the brand's own account.to:examplecofinds posts addressed to the support account.examplecoapp.com min_faves:10 since:2026-11-01finds posts that link the domain and have drawn some attention.
curl "https://api.handlesapi.com/v1/x/search/tweets?query=%22Example%20Co%22%20-from%3Aexampleco%20lang%3Aen&limit=50" \
-H "Authorization: Bearer $HANDLES_API_KEY"const res = await fetch("https://api.handlesapi.com/v1/x/search/tweets?query=%22Example%20Co%22%20-from%3Aexampleco%20lang%3Aen&limit=50", {
headers: { Authorization: `Bearer ${process.env.HANDLES_API_KEY}` },
});
const { data, meta } = await res.json();import os
import requests
res = requests.get(
"https://api.handlesapi.com/v1/x/search/tweets?query=%22Example%20Co%22%20-from%3Aexampleco%20lang%3Aen&limit=50",
headers={"Authorization": f"Bearer {os.environ['HANDLES_API_KEY']}"},
timeout=30,
)
body = res.json()Use the default Latest tab for anything you count. Top is ranked by X and partial on purpose, so a total under Top undercounts volume.
A polling loop that dedupes by post id
This API answers requests and does not push events, so monitoring means polling: run the search on a schedule and keep only the posts you have not seen. The loop below dedupes on tweet_id, pages with the cursor until it reaches a known post, and retries 503.
const BASE = "https://api.handlesapi.com/v1";
const headers = { Authorization: `Bearer ${process.env.HANDLES_API_KEY}` };
const QUERY = '"Example Co" -from:exampleco lang:en';
const MAX_PAGES = 3;
const seen = new Set(); // persist these ids in a database in production
async function getJson(url, tries = 3) {
for (let i = 1; i <= tries; i++) {
const res = await fetch(url, { headers, signal: AbortSignal.timeout(30_000) });
if (res.status === 503) {
await new Promise((r) => setTimeout(r, 2000 * i)); // upstream busy, retry
continue;
}
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return res.json();
}
throw new Error("X is unavailable right now");
}
async function check() {
const fresh = [];
let cursor = null;
for (let page = 0; page < MAX_PAGES; page++) {
const url = new URL(`${BASE}/x/search/tweets`);
url.searchParams.set("query", QUERY);
url.searchParams.set("limit", "50");
if (cursor) url.searchParams.set("cursor", cursor);
const { data, meta } = await getJson(url);
let known = 0;
for (const tweet of data.tweets) {
if (seen.has(tweet.tweet_id)) known++;
else { seen.add(tweet.tweet_id); fresh.push(tweet); }
}
cursor = meta.page.next_cursor;
if (known > 0 || !cursor) break; // reached posts we already have
}
return fresh;
}
for (;;) {
try {
for (const t of await check()) console.log(t.created_at, t.author.handle, t.url);
} catch (err) {
console.error("check failed:", err.message);
}
await new Promise((r) => setTimeout(r, 5 * 60_000));
}Cursors are X's own and expire, so use each one on the next call and do not store it. Deduping on the id is safer than remembering a position. The pagination guide covers the cursor contract, and errors lists which codes are worth a retry.
Replies and quote posts on one post
Replies and quotes are read per post, so run them for the posts that matter, such as a launch announcement or a complaint that is spreading. Both endpoints re-check every row against the parent id, so you get replies to that post only, not the whole conversation.
curl "https://api.handlesapi.com/v1/x/tweets/2125915027819446402/replies?limit=20" \
-H "Authorization: Bearer $HANDLES_API_KEY"
curl "https://api.handlesapi.com/v1/x/tweets/2125915027819446402/quotes?limit=20" \
-H "Authorization: Bearer $HANDLES_API_KEY"The mentions endpoint works the same way for an account: pass a handle with or without the @, and the account's own posts are excluded.
What a post looks like in the response
Every listening endpoint returns posts in one shape, with the text, engagement counters, flags for replies, quotes and reposts, and a full author object. This capture is from the timeline endpoint, which uses the same post format as search, mentions, replies and quotes.
curl "https://api.handlesapi.com/v1/x/users/nasa/tweets?limit=2" \
-H "Authorization: Bearer $HANDLES_API_KEY"const res = await fetch("https://api.handlesapi.com/v1/x/users/nasa/tweets?limit=2", {
headers: { Authorization: `Bearer ${process.env.HANDLES_API_KEY}` },
});
const { data, meta } = await res.json();import os
import requests
res = requests.get(
"https://api.handlesapi.com/v1/x/users/nasa/tweets?limit=2",
headers={"Authorization": f"Bearer {os.environ['HANDLES_API_KEY']}"},
timeout=30,
)
body = res.json(){
"data": {
"tweets": [
{
"tweet_id": "2125915027819446402",
"url": "https://x.com/NASA/status/2125915027819446402",
"text": "LIVE: Watch the Progress 97 spacecraft arrive and dock to the @space_station after a two-day trip...",
"created_at": "2026-11-26T11:30:14+00:00",
"lang": "en",
"source": null,
"likes": 833,
"retweets": 151,
"replies": 73,
"quotes": 16,
"bookmarks": 50,
"views": 276360,
"is_reply": false,
"is_retweet": false,
"is_quote": false,
"conversation_id": "2125915027819446402",
"in_reply_to_tweet_id": null,
"quoted_tweet_id": null,
"retweeted_tweet_id": null,
"hashtags": [],
"mentions": [
"Space_Station"
],
"links": [
"https://x.com/i/broadcasts/2onVBonVMMWjaV"
],
"media": [],
"author": {
"user_id": "11348282",
"handle": "NASA",
"display_name": "NASA",
"bio": "Making the seemingly impossible, possible. ✨",
"followers": 92086892,
"following": 115,
"tweets": 74588,
"media_count": 28267,
"likes_given": 17125,
"is_verified": false,
"is_blue_verified": true,
"is_protected": false,
"location": "Pale Blue Dot",
"avatar_url": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_400x400.jpg",
"header_url": "https://pbs.twimg.com/profile_banners/11348282/1788992290",
"created_at": "2007-12-19T20:20:32+00:00",
"profile_url": "https://x.com/NASA"
}
},
{
"tweet_id": "2125691860706333095",
"url": "https://x.com/NASA/status/2125691860706333095",
"text": "RT @NASASolarSystem: The thick atmosphere.\nThe rivers and lakes.\nThe sweeping dunes.\nThe complex...",
"created_at": "2026-11-25T20:43:27+00:00",
"lang": "en",
"source": "Twitter for iPhone",
"likes": 0,
"retweets": 368,
"replies": 0,
"quotes": 0,
"bookmarks": 0,
"views": 48738,
"is_reply": false,
"is_retweet": true,
"is_quote": false,
"conversation_id": "2125691860706333095",
"in_reply_to_tweet_id": null,
"quoted_tweet_id": null,
"retweeted_tweet_id": "2125681297859166579",
"hashtags": [],
"mentions": [
"NASASolarSystem"
],
"links": [],
"media": [],
"author": {
"user_id": "11348282",
"handle": "NASA",
"display_name": "NASA",
"bio": "Making the seemingly impossible, possible. ✨",
"followers": 92086892,
"following": 115,
"tweets": 74588,
"media_count": 28267,
"likes_given": 17125,
"is_verified": false,
"is_blue_verified": true,
"is_protected": false,
"location": "Pale Blue Dot",
"avatar_url": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_400x400.jpg",
"header_url": "https://pbs.twimg.com/profile_banners/11348282/1788992290",
"created_at": "2007-12-19T20:20:32+00:00",
"profile_url": "https://x.com/NASA"
}
}
],
"has_next_page": false
},
"meta": {
"page": {
"limit": 2,
"next_cursor": null,
"count": 2
},
"source": "live:xlookup",
"request_id": "req_503bc38c7610cc00",
"generated_at": "2026-11-26T13:54:58.874Z",
"took_ms": 1696
}
}Real response from the live API, captured Nov 26, 2026. Long strings and arrays are shortened.
Each author comes with the post, so counting verified or large accounts among your mentioners needs no second call.
Turning results into alerts
The API returns posts and counters, so the monitoring logic is yours. Store tweet_id, created_at, text, the counters and the author, then decide what deserves a human.
- Alert on reach. Compare
viewsandlikeswith a threshold, or addmin_faves:to the query so only posts with traction come back. - Alert on the author. Each post carries the author's follower count and verification flags, so a large account can outrank a loud one.
- Route by type. The
is_reply,is_quoteandis_retweetflags separate conversation from amplification.
- Get a key from the signup page and confirm it has the
scrape:livescope. - Run one search in curl to check the query returns what you expect. It costs 2 credits.
- Move the query into the loop above and persist the seen ids.
What 1,000 checks cost
One check is one live call, so 1,000 checks use 2,000 credits. The table shows what that costs on each plan.
| Plan | Monthly price | Credits | 1,000 catalog reads | 1,000 live reads |
|---|---|---|---|---|
| Handles API Starter | $29 | 15,000 | $1.93 | $3.87 |
| Handles API Pro | $99 | 75,000 | $1.32 | $2.64 |
| Handles API Business | $299 | 300,000 | $1.00 | $1.99 |
| Handles API Scale | $799 | 1,200,000 | $0.67 | $1.33 |
Your schedule decides the monthly total. These figures count one query over 30 days with one page per check, and each extra query or page multiplies them.
| Schedule | Checks per month | Credits per month | Smallest plan that fits |
|---|---|---|---|
| Every 15 minutes | 2,880 | 5,760 | Starter |
| Every 5 minutes | 8,640 | 17,280 | Pro |
| Every minute | 43,200 | 86,400 | Business |
The same job on the official X API
The official X API reads a post for $0.005, so the same monitoring costs depend on how many posts each check returns. The price list is on the X pricing page, as of November 2026.
| Posts returned per check | Official X API, 1,000 checks | Handles API, 1,000 checks |
|---|---|---|
| 1 post | $5.00 | 2,000 credits, the same at any size |
| 5 posts | $25.00 | 2,000 credits, the same at any size |
| 20 posts | $100.00 | 2,000 credits, the same at any size |
| 100 posts | $500.00 | 2,000 credits, the same at any size |
The official bill grows with every post returned and is zero for an empty check. We bill per request, so a busy query is cheap and a quiet one still costs 2 credits a check. The official API is also the right tool if you need to reply or act as your brand. The X API pricing guide has the full price list and rate limits.
Limits to know before you build
- Search exists for X only. For Instagram, TikTok, YouTube and the other platforms the catalog holds profile data, not keyword search over posts.
- Live calls take 2 to 25 seconds and can return 503 under load. Set a 30 second timeout and retry 503, but never cache a 503 as an empty result.
- The X search index is not an archive. An empty list means the post is not in the index, not that it was never posted.
- The service is read-only. It cannot reply, like or message anyone, and it cannot see protected accounts or private posts.
- The
scrape:livescope is not on keys by default and must be enabled.
To go from brand mentions to the people behind them, see influencer analytics. The X API page lists every X endpoint, and the Twitter scraper guide compares this route with building your own. Start with the 100 free credits, which cover 50 checks.
Frequently asked questions
What is a social listening API?
Can I monitor Instagram or TikTok keywords the same way?
How often should I poll for new mentions?
How much does it cost to monitor a brand on X?
Does the search see every post on X?
Why does my X call return 403?
Try it on your own handles
The free trial gives you 100 credits for every endpoint, once, with no card. Paid plans start at $29 a month.