Twitter

Search Twitter Posts

Search for tweets by keyword. Returns tweet content, author username, URL, publication date, engagement metrics (likes, retweets, replies, quotes, bookmarks, views), author info (follower count, verification), language, hashtags, and user mentions. Supports sorting by most recent or relevance, and filtering by time window (posted_ago) or date range (start_date, end_date). Fetch multiple pages in a single request.

Price: $0.006 per page. Free tier: 50 requests/month.

get/v1/twitter/posts

Request

  • Base URL: https://apidirect.io
  • URL: https://apidirect.io/v1/twitter/posts
  • Auth: API key in header X-API-Key

Query parameters

querystring required

Search query (max 500 characters). Supports X's search operators (https://help.x.com/en/using-x/x-advanced-search).

pagesinteger

Number of pages to fetch and merge into one response (1-20, billed per page). Fetching stops early when there are no more results.

sort_by'most_recent' | 'relevance'

Sort order for results

posted_ago'1h' | '24h' | '7d' | '30d' | '12m'

Only return posts from this period: 1h (past hour), 24h (past day), 7d (past week), 30d (past month), or 12m (past year). Works with both sort orders. Omit for all time. Can't be combined with start_date or end_date. Any other value returns 400.

start_datestring date

Only return posts from this date onward (YYYY-MM-DD, UTC). Can't be combined with posted_ago.

end_datestring date

Only return posts up to and including this date (YYYY-MM-DD, UTC). Must not be earlier than start_date. Can't be combined with posted_ago.

get_sentimentboolean

Set to true to add AI emotion analysis to each post. Adds a sentiment object containing emotions (joy, trust, fear, surprise, sadness, disgust, anger and anticipation, each scored 0-100), dominant_emotion, emotional_intensity (0-10), and polarity (positive, negative or neutral). Any post that cannot be scored returns sentiment: null.

Response

Successful response

countnumber nullable
pagesnumber nullable

Changes

No recorded changes to this operation across all 1 revision of this API.