X (Twitter)

Introduction

The Twitter API allows you to access and interact with Twitter data. It provides various endpoints for searching tweets, retrieving user profiles, and accessing trends and analytics.

  • Base URL: https://api.webit.live/api/v1/realtime/social/twitter/v1

Key Endpoints

  • Search: Search for tweets based on keywords, hashtags, or phrases. This endpoint helps in discovering relevant tweets and trending topics.

  • Profiles: Retrieve detailed information about Twitter user profiles, including their bio, tweets, followers, and following. This is useful for analyzing user activity and influence.

  • Tweets: Get specific tweets, including their content, engagement metrics, and replies. This endpoint helps in analyzing individual tweets and their impact.

  • Explore: Access trending topics, hashtags, and other content discovery features. This endpoint is useful for understanding current trends and popular content on Twitter.

SearchProfilesTweetsExplore

API Limitations

Below is a table summarizing the limits for results per request and total results for each endpoint in the Twitter API:

Please note that these are approximate values and actual limits might vary depending on several factors such as the specific parameters used in requests, and Twitter's ongoing updates to their API policies.

EndpointTotal Results LimitResults Per Request

Search Top

~350

<20

Search Latest

No Limit

<20

Search Photos

~400

<20

Search Videos

~400

<20

Search People

~1000

<20

Profile Feed

No Limit

<20

Profile Tweets

~700

<20

Profile Followers

No Limit

50 - 70

Profile Following

No Limit

50 - 70

Profile Likes

~120

20

Profile Media

No Limit

<20

Profile Replies

No Limit

<20

Tweets Likers

No Limit

~90

Tweets Retweets

No Limit

~100

Tweets Quotes

No Limit

<20

Tweets Replies

~200

10

General Operators

Operator

Description

keyword

Matches a keyword or an emoji within the body of a Tweet or User details (screen name, alias, bio). Example: (😃 OR 😡) elon musk

exact phrase match

Matches the exact phrase within the body of a Tweet. Example: "rate limits"

#

Matches any Tweet containing a recognized hashtag. Example: #ycombinator

@

Matches any Tweet that mentions the given username. Example: @elonmusk

from

Matches any Tweet from a specific username. Example: from:elonmusk

$

Matches any Tweet that contains the specified cashtag. Example: $FB

to

Matches any Tweet that is in reply to a particular username. Example: to:elonmusk

url

Matches any url within the body of the Tweet. Example: url:"https://techcrunch.com"

filter:replies

Match only Tweet replies.

filter:quote

Match only Quote Tweets.

filter:media

Match only Tweets with media.

filter:images

Match only Tweets with images.

filter:videos

Match only Tweets with videos.

filter:links

Match only Tweet with links.

filter:hashtags

Match only Tweet with hashtags.

conversation_id

Matches Tweets that share a common conversation ID. A conversation ID is set to the Tweet ID of a Tweet that started a conversation. As Replies to a Tweet are posted, even Replies to Replies, the conversation_id is added to its JSON payload. Must come in conjunction with at least one other rule. Example: conversation_id:1676361980486250496 filter:replies

quoted_tweet_id

Matches on Quote Tweets of the specified Tweet. Example: quoted_tweet_id:1676361980486250496

quoted_user_id

Matches on Quote Tweets of the specified user ID. Example: quoted_user_id:44196397

near

Matches Tweets tagged with the specified location. Example: near:"new york city" OR near:seattle

within

Matches Tweets within the radius of the specified location by the near operator Can specify km or mi. Must come in conjunction with near operator. Example: within:15km near:"new york"

geocode

Match location by geocode and radius, alternative to near and within Example: geocode:52.379245,4.900399,0.1km

since_time

Match Tweet after a certain timestamp. Must come in conjunction with at least one other rule. Example: since_time:1688813758 Napoleon

until_time

Match Tweet before a certain timestamp. Must come in conjunction with at least one other rule. Example: until_time:1688900223 Napoleon

since

Match Tweet after a certain date. Must come in conjunction with at least one other rule. Example: since:2023-01-01 Napoleon

until

Match Tweet before a certain date. Must come in conjunction with at least one other rule. Example: until:2008-12-30 Napoleon

lang

Match Tweets in a certain language. Example: lang:fr

list

Match Tweets in a certain list by list ID. Example: list:183873847

min_retweets

Match Tweets with a minimum count of retweets. Example: min_retweets:10000

min_faves

Match Tweets with a minimum count of likes. Example: min_faves:10000

min_replies

Match Tweets with a minimum count of replies. Example: min_replies:10000

include:nativeretweets

Include retweets in your search results

FAQ

How do I authorize my requests to the Twitter API?

To authorize your requests to the Twitter API, you must include the x-api-key in the HTTP header of your requests.

How do I retrieve a user's profile details using their screen name?

To retrieve a user's profile details using their screen name, you need to use the Profile Details endpoint.

How do I use the "cursor" parameter for pagination?

When interacting with Twitter API endpoints that support pagination, you may come across the cursor parameter.

There are two types of cursors: cursor_top and cursor_bottom.

  • cursor_bottom: Used to retrieve the next page of results. Using the cursor_bottom is the most common method when navigating through consecutive pages of results.

  • cursor_top: Used to retrieve the previous page of results. It points to the preceding set of data.

What are the limits for each Twitter API endpoint?

Below is a table summarizing the limits for results per request and total results for each endpoint in the Twitter API:

What are the available search operators?
  • AND logic - Successive operators with a space between them will result in boolean "AND" logic, meaning that Tweets will match only if both conditions are met. For example, snow day #NoSchool will match Tweets containing the terms snow and day and the hashtag #NoSchool.

  • OR logic - Successive operators with OR between them will result in OR logic, meaning that Tweets will match if either condition is met. For example, specifying grumpy OR cat OR #meme will match any Tweets containing at least the terms grumpy or cat, or the hashtag #meme.

  • NOT logic, negation - Prepend a dash (-) to a keyword (or any operator) to negate it (NOT). For example, cat #meme -grumpy will match Tweets containing the hashtag #meme and the term cat, but only if they do not contain the term grumpy. All operators can be negated, but negated operators cannot be used alone.

  • Grouping - You can use parentheses to group operators together. For example, (grumpy cat) OR (#meme has:images) will return either Tweets containing the terms grumpy and cat, or Tweets with images containing the hashtag #meme. Note that ANDs are applied first, then ORs are applied.

Last updated