Skip to main content
Fetches tweets from Twitter/X using the TwitterAPI.io advanced search API. Uses Twitter’s native advanced search syntax (from:, to:, lang:, since:, until:, OR, etc.). Returns a dataset with 37 columns: tweet text, author info, engagement metrics, entities (hashtags, URLs, mentions), media URLs, and quoted/retweeted tweets. Cost: ~$0.15 per 1,000 tweets (15 credits per tweet).

Query Syntax

Error Handling

  • Rate limit (429): Retries with exponential backoff
  • Credits exhausted (402): Returns partial data with warning (W41)
  • Timeout: Returns partial data with warning (W41)
Learn more at docs.twitterapi.io.

Usage

The following example shows how the step can be used in a recipe.

Examples

Fetch tweets about climate change in English

Inputs & Outputs

The following are the inputs expected by the step and the outputs it produces. These are generally columns (ds.first_name), datasets (ds or ds[["first_name", "last_name"]]) or models (referenced by name e.g. "churn-clf").
dataset
required
The dataset containing tweets from the search.

Configuration

The following parameters can be used to configure the behaviour of the step by including them in a json object as the last “input” to the step, i.e. step(..., {"param": "value", ...}) -> (output).

Parameters

string
required
TwitterAPI.io Integration. ID of your TwitterAPI.io integration containing the API key.
string
required
Search Query. Twitter advanced search query. Supports operators: from:, to:, lang:, since:YYYY-MM-DD, until:YYYY-MM-DD, OR, -, “exact phrase”, min_replies:, min_faves:, filter:links, filter:media. Reference: https://github.com/igorbrigadir/twitter-advanced-search.
string
default:"Latest"
Sort Order. Sort order. “Latest” for chronological, “Top” for most relevant.Values must be one of the following:
  • Latest
  • Top
integer
Max Tweets. Maximum number of tweets to fetch. Leave empty to fetch all matching tweets. Cost: ~15 credits per tweet ($0.15 per 1,000 tweets).
integer
default:"3600"
Timeout. Maximum seconds to wait for the search to complete.