Tweet Search
API for searching Twitter tweets
Tweet Search
Search for tweets on Twitter by finding relevant content with keywords.
Request
URL: /api/twitter/search
Method: GET or POST
Request Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| rawQuery | string | Yes | Search query string, can include keywords, usernames, hashtags, etc. |
Response
A successful response will return a list of tweets matching the search query, sorted by relevance, including tweet content, creation time, author information, etc.
Examples
Request Example
# GET request
curl --request GET \
--url 'https://www.aidir.fun/api/twitter/search?rawQuery=artificial%20intelligence' \
--header 'X-API-Key: <api-key>'
# POST request
curl --request POST \
--url 'https://www.aidir.fun/api/twitter/search' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '{
"rawQuery": "artificial intelligence"
}'Response Example
{
"data": {
"search_metadata": {
"query": "artificial intelligence",
"count": 10
},
"timeline": {
"instructions": [
{
"entries": [
{
"content": {
"tweet": {
"id": "1512345678901234567",
"text": "The latest developments in artificial intelligence are truly amazing!",
"created_at": "2023-04-15T14:34:12.000Z",
"author": {
"id": "9876543210",
"name": "Tech Enthusiast",
"screen_name": "techenthusiast"
},
"favorite_count": 123,
"retweet_count": 45,
"reply_count": 6,
"quote_count": 2
}
}
}
]
}
]
}
}
}Error Responses
| Status Code | Description |
|---|---|
| 400 | Request parameter error, e.g., missing required rawQuery parameter |
| 401 | Authentication failed, API key invalid or missing |
| 500 | Internal server error |
Search Tips
You can use the following syntax in your search query to optimize search results:
from:username- Find tweets published by a specific user#hashtag- Find tweets containing a specific hashtag"exact phrase"- Find tweets containing an exact phrasesince:YYYY-MM-DD- Find tweets after a specific dateuntil:YYYY-MM-DD- Find tweets before a specific date
For example, the search query "artificial intelligence" from:elonmusk since:2023-01-01 will find tweets by Elon Musk published after January 1, 2023, containing the exact phrase "artificial intelligence".
Aidir Docs