Answers
Which X advanced search operators work through an API?
Short answer
X post search passes your query to X's own search, so the operators that work in the X search box work here too: from:, to:, quoted phrases, OR, -, lang:, since:, until:, min_faves:, filter:media, -filter:replies and so on. Each page of about 20 posts costs $0.006 whatever the operators, so 1,000 matching posts cost $0.30.
An analyst wants last week's Japanese posts that mention a product, with at least 100 likes and no replies. In the X search box that is one line: "claude code" lang:ja since:2026-11-05 min_faves:100 -filter:replies. The same line works as the query of X post search. The query goes to X's search as typed, so if a query returns posts on x.com, it returns them here.
Operators people use most
| Operator | Example | Finds |
|---|---|---|
from: / to: |
from:openai, to:openai |
posts by, or replies to, an account |
"..." |
"open source" |
the exact phrase |
OR, - |
rag OR retrieval -job |
either word, minus a word |
lang: |
lang:de |
one language |
since: / until: |
since:2026-10-01 until:2026-11-01 |
a date window |
min_faves: / min_retweets: / min_replies: |
min_faves:500 |
posts above an engagement floor |
filter: |
filter:media, -filter:replies |
media posts, no replies |
#, @ |
#AI, @vercel |
hashtags and mentions |
X does not publish a complete list for its search box and changes behaviour now and then. Test a new query on x.com first. If the website gets it right, the API call will match.
Price and paging
The price is per page, never per operator: $0.006 for about 20 posts. A tight query is the cheapest kind, because you page less to reach the posts you want.
| Job | Pages | Cost |
|---|---|---|
| Top 100 posts for a query | 5 | $0.03 |
| 1,000 posts | 50 | $0.30 |
sort=top gives X's Top tab, sort=latest the Latest tab.
curl -G "https://api.okdata.online/v1/x/posts/search" \
-H "Authorization: Bearer $OKDATA_API_KEY" \
--data-urlencode 'query="claude code" lang:ja min_faves:100 -filter:replies' \
--data-urlencode 'sort=top' \
--data-urlencode 'fields=id,url,text,published_at,metrics.likes,metrics.views'
Use --data-urlencode for the query; quotes, colons and spaces must be encoded.
How the official API differs
X's own v2 search uses a different operator set: -is:retweet, has:media, is:reply and so on. Recent search covers the last 7 days for all developers, and full-archive search goes back to 2006 for pay-per-use and Enterprise accounts, at $0.005 per post returned. X deprecated the count operators there in January 2026, then added min_likes:, min_replies: and min_reposts: back after moving search to a new index in May. If you need a documented, contractual search, use theirs. If you want the search box's syntax and per-page billing, use this one.
Gotchas
- Only public posts come back. Protected accounts never appear.
- For a long date window, run several short
since:/until:slices withsort=latest. It is easier to see that every week was covered. - Search results already carry views, likes, replies, reposts and bookmarks; you rarely need a second call per post.
To have an agent write and run these queries for you, connect the MCP server.
Updated