Twitter Automation API (POST, REPLY, LIKE, RETWEET, SCRAP))
Pricing
$15.00 / 1,000 results
Twitter Automation API (POST, REPLY, LIKE, RETWEET, SCRAP))
A powerful and flexible Twitter/X automation API built as an Apify Actor. This API enables you to scrape tweets, post new tweets, reply to tweets, like tweets, and retweet using Playwright browser automation.
Pricing
$15.00 / 1,000 results
Rating
5.0
(2)
Developer

Mahmoud Alhamdo
Actor stats
5
Bookmarked
17
Total users
4
Monthly active users
28 days
Issues response
12 days ago
Last modified
Categories
Share
Twitter Automation API
A powerful and flexible Twitter/X automation API built as an Apify Actor. This API enables you to scrape tweets, post new tweets, reply to tweets, like tweets, and retweet using browser automation.
π Features
-
Multiple Modes:
- User Mode: Scrape latest tweets from any Twitter/X user profile
- Single Tweet Mode: Extract data from a specific tweet URL
- Post Mode: Publish a new tweet
- Reply Mode: Reply to a specific tweet
- Like Mode: Like a single tweet or multiple tweets (up to 5)
- Retweet Mode: Retweet a single tweet or multiple tweets (up to 5)
-
Comprehensive Data Extraction:
- Tweet text content
- Tweet ID and URL
- Author username
- Timestamp
- Engagement metrics (likes, retweets, replies, views, bookmarks)
- Image URLs (if present)
- Image detection flag
-
Smart Features:
- Automatic pinned tweet filtering
- Real-time data saving to dataset
- Duplicate tweet detection
- Automatic scrolling for pagination
- Batch operations: Like or retweet up to 5 tweets at once
- Configurable delays between actions to avoid rate limiting
- Organized output views for different operation types
-
Robust & Reliable:
- Error handling and retry logic
- Realistic browser behavior
- Smart waiting mechanisms
π Input Parameters
Required
- mode (string): Operation mode -
"user","single","post","reply","like", or"retweet"
Authentication (Required for interaction modes)
- ct0 (string): Twitter ct0 cookie for authentication (required for post, reply, like, retweet modes)
- auth_token (string): Twitter auth_token cookie for authentication (required for post, reply, like, retweet modes)
For User Mode (Scraping)
- username (string): Twitter username without @ (e.g.,
"AlamawiEth") - maxTweets (integer): Maximum number of tweets to scrape (1-1000, default: 3)
- maxDaysOld (integer): Only scrape tweets from the last N days (0 = no limit, default: 2)
For Single Tweet Mode
- tweetUrl (string): Full URL of the tweet to scrape
For Post Mode (Publish Tweet)
- tweetText (string, required): Text content of the tweet to post
For Reply Mode
- replyTweetUrl (string, required): URL of the tweet to reply to
- replyText (string, required): Text content of the reply
For Like Mode
- tweetUrl (string, optional): URL of a single tweet to like (use this OR tweetUrls)
- tweetUrls (array, optional): Array of tweet URLs to like (maximum 5 tweets). Use this for multiple likes.
- delayBetweenActions (integer, optional): Delay in seconds between processing each tweet when using multiple tweets (0-60, default: 2). Helps avoid rate limiting.
Note: Use either tweetUrl for a single tweet OR tweetUrls for multiple tweets (up to 5).
For Retweet Mode
- tweetUrl (string, optional): URL of a single tweet to retweet (use this OR tweetUrls)
- tweetUrls (array, optional): Array of tweet URLs to retweet (maximum 5 tweets). Use this for multiple retweets.
- delayBetweenActions (integer, optional): Delay in seconds between processing each tweet when using multiple tweets (0-60, default: 2). Helps avoid rate limiting.
Note: Use either tweetUrl for a single tweet OR tweetUrls for multiple tweets (up to 5).
π Example Inputs
User Mode
{"mode": "user","username": "apify","maxTweets": 50,"maxDaysOld": 5}
Post Tweet Mode
{"mode": "post","tweetText": "Hello from Apify Actor! π","ct0": "your_ct0_cookie_value","auth_token": "your_auth_token_value"}
Reply Mode
{"mode": "reply","replyTweetUrl": "https://x.com/user1/status/1234567890","replyText": "Great tweet! Thanks for sharing.","ct0": "your_ct0_cookie_value","auth_token": "your_auth_token_value"}
Like Mode - Single Tweet
{"mode": "like","tweetUrl": "https://x.com/user1/status/1234567890","ct0": "your_ct0_cookie_value","auth_token": "your_auth_token_value"}
Like Mode - Multiple Tweets
{"mode": "like","tweetUrls": ["https://x.com/user1/status/1234567890","https://x.com/user2/status/0987654321","https://x.com/user3/status/1122334455"],"delayBetweenActions": 3,"ct0": "your_ct0_cookie_value","auth_token": "your_auth_token_value"}
Retweet Mode - Multiple Tweets
{"mode": "retweet","tweetUrls": ["https://x.com/user1/status/1234567890","https://x.com/user2/status/0987654321"],"delayBetweenActions": 3,"ct0": "your_ct0_cookie_value","auth_token": "your_auth_token_value"}
π Output Schema
The Actor provides organized output views in Apify Console for different operation types:
- π Overview: Complete view of all operations
- βοΈ Posted Tweets: View for posted tweets
- π¬ Replies: View for replies
- β€οΈ Likes: View for liked tweets
- π Retweets: View for retweeted tweets
- π Scraped Tweets: View for scraped tweets
For Scraping Modes (user, single)
Each tweet in the dataset contains:
{"tweetId": "1987766870477619331","text": "Tweet text content...","username": "AlamawiEth","timestamp": "2025-11-10T06:18:47.000Z","url": "https://x.com/user1/status/1234567890","likes": 59,"retweets": 4,"replies": 7,"views": 24796,"bookmarks": 0,"images": ["https://pbs.twimg.com/media/XXX?format=jpg&name=medium"],"hasImages": true,"scrapedAt": "2025-11-12T05:00:15.702372"}
For Post Mode
{"success": true,"mode": "post","tweetId": "1987766870477619331","url": "https://x.com/user1/status/1234567890","text": "Tweet text...","postedAt": "2025-11-12T05:00:15.702372"}
For Reply Mode
{"success": true,"mode": "reply","originalTweetUrl": "https://x.com/user1/status/1234567890","replyId": "1987766870477619331","replyUrl": "https://x.com/user1/status/1987766870477619331","replyText": "Reply text...","repliedAt": "2025-11-12T05:00:15.702372"}
For Like/Retweet Mode
Single Tweet:
{"success": true,"mode": "like","tweetUrl": "https://x.com/user1/status/1234567890","action": "liked","likedAt": "2025-11-12T05:00:15.702372"}
Multiple Tweets:
{"success": true,"mode": "like","tweetUrl": "https://x.com/user1/status/1234567890","tweetIndex": 1,"totalTweets": 3,"action": "liked","likedAt": "2025-11-12T05:00:15.702372"}
π Authentication Setup
Authentication cookies are required for all interaction modes (post, reply, like, retweet) and recommended for scraping modes.
How to Get Cookies
-
Install Cookie Editor Extension:
- Install from Chrome Web Store
-
Login to Twitter/X:
- Go to https://x.com and login to your account
-
Extract Cookies:
- Open Cookie Editor extension
- Search for
ct0and copy its value - Search for
auth_tokenand copy its value
-
Use in Actor Input:
- Paste the values in the
ct0andauth_tokenfields
- Paste the values in the
β οΈ Security Warning
- Never share your cookies with anyone you don't trust
- Cookies contain sensitive login information
- Anyone with your cookies can access your account
- Only use cookies in secure environments
- Consider using a separate Twitter account for automation
Benefits of Using Cookies
- β Access to advanced search with date filters
- β Better filtering of recent tweets
- β More reliable scraping results
- β Required for all interaction modes
π How It Works
User Mode
- Navigate to user profile or use advanced search (if authenticated)
- Extract tweets one by one
- Filter by date if
maxDaysOldis set - Skip pinned tweets automatically
- Save to dataset in real-time
- Continue until reaching
maxTweetsor no more tweets available
Post Mode
- Navigate to Twitter home page
- Enter tweet text
- Submit tweet
- Return posted tweet data (URL, ID, timestamp)
Reply Mode
- Navigate to the tweet URL
- Click reply button
- Enter reply text
- Submit reply
- Return reply confirmation with URL and ID
Like/Retweet Mode
Single Tweet:
- Navigate to the tweet URL
- Click like/retweet button
- Confirm action (for retweet)
- Return confirmation
Multiple Tweets:
- Process each tweet sequentially
- Wait for configured delay between actions
- Return results with index and total count
- Continue until all tweets are processed
π― Use Cases
- Social Media Monitoring: Track tweets from specific accounts
- Content Analysis: Analyze tweet engagement metrics
- Image Collection: Extract images from tweets
- Data Research: Collect tweet data for analysis
- Brand Monitoring: Monitor mentions and engagement
- Automated Posting: Schedule and post tweets automatically
- Engagement Automation: Automatically like, retweet, or reply to tweets
- Social Media Management: Manage Twitter account interactions programmatically
- Batch Operations: Process multiple tweets efficiently with configurable delays
π Privacy & Compliance
- This Actor respects Twitter/X's public data
- Authentication (cookies) is required for interaction modes (post, reply, like, retweet)
- Authentication (cookies) is optional but recommended for scraping modes (user, single)
- Private profiles will not be accessible
- Never share your cookies - they contain sensitive login information
- Important: All interaction modes require valid authentication cookies
- Please review Twitter/X Terms of Service before use
- Be mindful of rate limits when using interaction modes
Note: This Actor is designed for educational and research purposes. Always comply with Twitter/X Terms of Service and applicable laws when scraping data.