How do I filter tweets by likes or retweets?
You cannot on X API v2. The min_faves and min_retweets operators exist in the search syntax but are dropped for API callers, so the query runs without them and you get unfiltered results.
This is the part that wastes an afternoon: the operators do not error. A query carrying min_faves:100 is accepted, the filter is ignored, and the response looks like a normal result set, so the first sign that something is wrong is a chart that does not match what you see on x.com.
Two ways out.
Filter client side
Request the posts, then drop the ones below your threshold. Correct, and the reason it is unsatisfying is cost: you pay for everything you pull, including everything you then throw away. On a popular term most of a page is usually discarded.
const popular = tweets.filter(t => t.public_metrics.like_count >= 100)
Or filter on the provider side
XCrop passes engagement floors to X as part of the query, so the posts below the threshold are never returned and never billed. POST /v2/search takes min_likes, min_retweets and min_replies:
curl -X POST https://xcrop.io/api/v2/search \ -H "Authorization: Bearer xc_live_..." \ -H "Content-Type: application/json" \ -d '{ "query": "bitcoin", "min_likes": 100, "count": 50 }'