Twitter Search
X search results are public posts selected for a query, carrying the language, author, media, entities, conversation context, and visible engagement of each match. Keeping the query beside every record makes recurring topic scans, launch listening, and result-set comparisons easier to audit.
Twitter Search API Features
- Discovery from one expressionSubmit a non-empty keyword or search expression and turn its matching public X posts into structured records.
- Ordering for two research modesUse latest to follow recent matches or top to review prominent matches, with latest selected by default.
- A practical search-result capRequest 20 to 2,000 results from the Twitter Search API in increments of 20 to set the maximum depth of the search collection.
- Matches that retain their queryCombine text, author, engagement, media, entities, timestamps, and relationship fields with extra.search_query and collected_at.
Twitter Search API Parameters
| Parameters | Required | Description |
|---|---|---|
query | Required | Required non-empty keyword or X post search expression used to discover matching public posts. |
results_limit | Optional | Optional requested result cap. Defaults to 20 and accepts multiples of 20 from 20 to 2,000. |
sort_by | Optional | Optional ordering with latest for recent matches or top for prominent matches. Defaults to latest. |
How to Use the Twitter Search API
Frame a precise research question as a search expression for the Twitter Search API, select the ordering that fits it, and preserve the query with the resulting posts.
- Write one focused, non-empty expression for the X posts you want to find.
- Select latest or top and choose a results_limit from 20 to 2,000 in increments of 20.
- POST the request to /v1/x/search, then poll /v1/tasks/{task_id} until completion.
- Store data.results.items, then follow next_cursor until has_more becomes false.
curl -X POST "https://api.socq.ai/v1/x/search" \
-H "Authorization: Bearer $SOCQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"artificial intelligence","results_limit":40,"sort_by":"latest"}'
# Poll GET /v1/tasks/{task_id}
# Read data.results.items and follow next_cursor while has_more is trueTwitter Search API Use Cases
- Listen around a named launch: Search a product, release, conference, or campaign phrase and organize matching posts by publication and collection time.
- Track brand and product mentions: Bring authors, text, visible engagement, hashtags, mentions, and media together for a focused name or phrase.
- Map a developing topic: Use latest results to follow new posts and top results to inspect prominent content within the same research expression.
- Maintain a recurring query dataset: Store extra.search_query with every match, rerun a versioned expression, and append only previously unseen post IDs.
Twitter Search API Pro Tips
- Begin with a focused expression, inspect the matches, and broaden the wording only when coverage is too narrow.
- Choose latest for time-sensitive listening and top when prominent matches matter more than chronology.
- Set results_limit as a multiple of 20 and interpret it as a cap, not a guaranteed result count.
- Version the query whenever its terms change so recurring result sets remain comparable.
- Deduplicate by post id while retaining extra.search_query and collected_at for discovery context.
Related APIs
Beyond the Twitter Search API, use these APIs when you need a different type of public X data.
- Twitter Tweet Scraper API — Retrieve public post text, authors, engagement, media, hashtags, mentions, and conversation relationships from x.com or twitter.com status URLs.
- Twitter Profile Scraper API — Retrieve public account identity, biographies, avatars, cover images, account status, and visible audience statistics by username.
- X Post Replies API — Collect public replies from X post URLs with selectable ordering, reply text, authors, visible engagement, media, and parent-post context.
- X Trends API — Collect current public X trend snapshots for known numeric WOEIDs with source rank, query, description, and location context.
- Twitter User Search API — Find public X accounts by keyword.
- X Communities Search API — Find communities by keyword, with member counts and links for the member and post endpoints.
- Twitter User Tweets Scraper API
- X Followers List API
- X Following List API
- X Post Quotes API
- X Post Retweeters API
- Twitter Mentions API
- X Community API
- X Community Posts API
- X Thread Context API
- X Account Location API
- X Verified Followers API
- X List Tweets API
- Twitter List Members API
- Twitter List Followers API
- X Community Members API
- X Community Moderators API
- X Articles API
- X Spaces API
- Twitter Media Scraper API
- X User Replies API
- Twitter Follow Checker API
- Twitter Video Transcript API