Search Twitter/X posts by keyword. Returns tweet content, engagement metrics (likes, retweets, replies, views, bookmarks), author metadata, and publication date. Supports fetching multiple pages of results in a single API call.
curl "https://apidirect.io/v1/twitter/posts?query=AI&pages=2&sort_by=most_recent" \
-H "X-API-Key: YOUR_API_KEY"
{
"posts": [
{
"title": "@username on X",
"url": "https://twitter.com/username/status/...",
"date": "2024-01-15 14:30:00",
"author": "username",
"source": "Twitter (X)",
"domain": "x.com",
"snippet": "Tweet content here...",
"likes": 142,
"retweets": 38,
"replies": 12,
"quotes": 5,
"bookmarks": 23,
"views": 18420,
"author_followers": 5243,
"author_verified": false,
"lang": "en",
"is_reply": false,
"is_quote": false,
"hashtags": ["AI", "MachineLearning"],
"user_mentions": ["OpenAI"],
"sentiment": {
"emotions": {
"joy": 40,
"trust": 55,
"fear": 0,
"surprise": 10,
"sadness": 0,
"disgust": 0,
"anger": 0,
"anticipation": 30
},
"dominant_emotion": "trust",
"emotional_intensity": 5,
"polarity": "positive"
}
}
],
"pages": 2,
"count": 40
}