Twitter API enforces rate limits to prevent abuse and ensure fair usage. Understanding these limits is crucial for building reliable applications with Twikit.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/d60/twikit/llms.txt
Use this file to discover all available pages before exploring further.
How rate limits work
Rate limits in the Twitter API:- Reset every 15 minutes: All rate limits have a 15-minute window
- Per endpoint: Each API endpoint has its own limit
- Per account: Limits are tracked separately for each authenticated account
- Different for guests: GuestClient has lower limits than authenticated Client
When you hit a rate limit, you must wait until the current 15-minute window expires before making more requests to that endpoint.
Rate limit table
Here are the rate limits for common Twikit functions (limits reset every 15 minutes):User operations
| Function | Limit | Endpoint |
|---|---|---|
get_user_by_screen_name | 95 | UserByScreenName |
get_user_by_id | 500 | UserByRestId |
get_user_followers | 50 | Followers |
get_user_following | 500 | Following |
get_user_verified_followers | 500 | BlueVerifiedFollowers |
get_user_followers_you_know | 500 | FollowersYouKnow |
follow_user | 15 | friendships/create.json |
unfollow_user | 187 | friendships/destroy.json |
block_user | 187 | blocks/create.json |
unblock_user | 187 | blocks/destroy.json |
mute_user | 187 | mutes/users/create.json |
unmute_user | 187 | mutes/users/destroy.json |
Tweet operations
| Function | Limit | Endpoint |
|---|---|---|
get_tweet_by_id | 150 | TweetDetail |
search_tweet | 50 | SearchTimeline |
get_user_tweets (Tweets) | 50 | UserTweets |
get_user_tweets (Replies) | 50 | UserTweetsAndReplies |
get_user_tweets (Media) | 500 | UserMedia |
get_user_tweets (Likes) | 500 | Likes |
get_favoriters | 500 | Favoriters |
get_retweeters | 500 | Retweeters |
create_tweet | - | CreateTweet |
delete_tweet | - | DeleteTweet |
retweet | - | CreateRetweet |
delete_retweet | - | DeleteRetweet |
favorite_tweet | - | FavoriteTweet |
unfavorite_tweet | - | UnfavoriteTweet |
Timeline operations
| Function | Limit | Endpoint |
|---|---|---|
get_timeline | 500 | HomeTimeline |
get_latest_timeline | 500 | HomeLatestTimeline |
List operations
| Function | Limit | Endpoint |
|---|---|---|
get_list | 500 | ListByRestId |
get_list_tweets | 500 | ListLatestTweetsTimeline |
get_lists | 500 | ListsManagementPageTimeline |
get_list_members | 500 | ListMembers |
get_list_subscribers | 500 | ListSubscribers |
create_list | - | CreateList |
add_list_member | - | ListAddMember |
remove_list_member | - | ListRemoveMember |
Direct messages
| Function | Limit | Endpoint |
|---|---|---|
get_dm_history | 900 | conversation/.json |
send_dm | 187 | dm/new2.json |
delete_dm | - | DMMessageDeleteMutation |
Other operations
| Function | Limit | Endpoint |
|---|---|---|
get_bookmarks | 500 | Bookmarks |
get_notifications (All) | 180 | notifications/all.json |
get_notifications (Mentions) | 180 | notifications/mentions.json |
get_trends | 20000 | guide.json |
login | 187 | onboarding/task.json |
logout | 187 | account/logout.json |
search_user | 50 | SearchTimeline |
Functions marked with ”-” have no documented rate limit or are unlimited.
Handling rate limit errors
When you exceed a rate limit, Twikit raises aTooManyRequests exception:
Best practices for staying under limits
1. Use pagination wisely
Don’t request more data than you need at once:2. Implement exponential backoff
Retry failed requests with increasing delays:3. Cache responses
Store results to avoid repeated requests:4. Batch operations
Group related operations to minimize requests:5. Monitor your usage
Track how many requests you’re making:Pagination strategies
Many Twikit methods returnResult objects that support pagination:
Rate limits for AsyncGenerator methods
Some methods returnAsyncGenerator for streaming results:
What happens when you hit the limit
- API returns 429 status: Twitter’s API responds with HTTP 429 (Too Many Requests)
- Twikit raises exception:
TooManyRequestsis raised with error details - Wait required: You must wait until the rate limit resets (up to 15 minutes)
- Headers provide info: The exception includes
rate_limit_resettimestamp
Related
Error handling
Learn to handle TooManyRequests and other errors
Async usage
Use async/await for efficient request handling
