Advanced Search
GET
Search for tweets using advanced query parameters
GET /api/v1/twitter/tweets/advanced_search
You can use Twitter's Advanced Search Interface to visually build complex search queries. After creating your search on Twitter, you can copy the generated search query from the URL or search box and use it with this API endpoint.
Authorization
X-API-Key
stringrequired
Parameters
Name | Type | Required | Description |
---|---|---|---|
query | string | required | Twitter search query |
mode | string | optional | Search mode (Latest = 1, Top = 0) Default: Latest Allowed values: Latest Top |
cursor | string | optional | Pagination cursor for fetching next page of results |
Query Syntax
Common Search Operators
from:username
Tweets from a specific user
to:username
Tweets replying to a specific user
"exact phrase"
Tweets containing the exact phrase
word1 OR word2
Tweets containing either word
-word
Tweets excluding the word
#hashtag
Tweets containing a specific hashtag
since:YYYY-MM-DD
Tweets after a specific date
until:YYYY-MM-DD
Tweets before a specific date
filter:media
Tweets containing media
filter:links
Tweets containing links
Example Request
curl -X GET \
"https://api.xscraper.xyz/api/v1/twitter/tweets/advanced_search?query=from:elonmusk&mode=1" \
-H "X-API-Key: "
Response
Search Results
application/json
{
"data": {
"tweets": [
{
"id": "1722715025402413077",
"text": "This is a sample tweet",
"username": "elonmusk",
"name": "Elon Musk",
"userId": "44196397",
"likes": 50000,
"replies": 5000,
"retweets": 10000,
"views": 2000000,
"timeParsed": "2025-04-18T15:30:00.000Z",
"hashtags": ["sample", "tweet"],
"mentions": [],
"photos": [],
"videos": [],
"urls": [],
"isReply": false,
"isRetweet": false,
"isQuoted": false
}
],
"next": "cursor_token_for_next_page",
"previous": null
},
"meta": {
"statusCode": 200,
"timestamp": "2025-04-19T15:49:28.824Z"
}
}
Error Responses
401 Unauthorized
{
"statusCode": 401,
"timestamp": "2025-04-19T15:49:28.824Z",
"path": "/api/v1/twitter/tweets/advanced_search",
"method": "GET",
"message": "Invalid or expired API key"
}
429 Too Many Requests
{
"statusCode": 429,
"timestamp": "2025-04-19T15:49:28.824Z",
"path": "/api/v1/twitter/tweets/advanced_search",
"method": "GET",
"message": "Rate limit exceeded. Please try again later."
}