X / Twitter User Search API
Returns X (Twitter) accounts that match a keyword, like the People tab of X search. It needs one input, query, which can be a topic, a name, or a handle. Each account comes back with its bio, follower, following and post counts, and profile links.
Use cases
- Build a lead list of accounts that talk about a topic, such as
ai agents, and sort them by followers.
- Find the account behind a brand or person name and get its numeric
id and username.
- Track new accounts in a niche by checking
createdUtc across search results.
- Collect bios and profile URLs to review which accounts claim to work on a given subject.
Request
curl -X POST "https://api.sandbase.ai/v1/api/twitter/search-users" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "ai agents"}'
The result is returned in outputs[0].data.
Parameters
Example response
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"nextCursor": "cur_Vlh_zPr3gk8IXhV_RYndHg",
"users": [
{
"avatarUrl": "https://pbs.twimg.com/profile_images/1878814517825572864/CjL1QsNr_normal.jpg",
"bio": "The first #AIAgent web3 solution for Gaming & Engagement 🎮\n\nPlay #Gamety app: ht…",
"canDm": null,
"coverUrl": "https://pbs.twimg.com/profile_banners/1754796337399316480/1741867369",
"createdUtc": 1707211049,
"followers": 168259,
"following": 106,
"id": "1754796337399316480",
"listedCount": null,
"location": null,
"name": "G-AGENTS AI💎",
"posts": 1031
}
]
},
"found": true
}
Response fields
Notes
- For the next page, send the
nextCursor value from the response as cursor with the same query.
requireFields accepts canDm, listedCount, and location. It applies to the first page only and can change which source serves the call and its price.
- To search posts instead of accounts, use Twitter Search Timeline.
- To get more detail on one account found here, call Twitter User Profile.
Pricing
Billed at the actual cost of each call, about $0.00054 for the request above. Failed calls are not charged.