Metrics
Overview
The metrics field allows developers to access public and private engagement metrics for Post and media objects. Public metrics are accessible by anyone with a developer account, while private metrics are accessible from owned/authorized accounts (definition below). Metrics include the total count of impressions, Retweets, Quote Tweets, likes, replies, video views, video view quartiles, URL and profile link clicks for each Post specified in the request. There is also the option to view a breakdown of metrics earned in an organic or promoted context, if the Post was promoted as an Ad.
Public metrics can be requested with App-only Token authentication. Non-public metrics can be requested for owned/authorized Posts only, meaning developers need to authenticate using OAuth 2.0 or OAuth 1.0a user context authorization.
Non-public, organic, and promoted metrics are only available for Posts created within the last 30 days.
Terminology
- Authorized account: An X account that has authorized your X developer app by granting it access to that account (any app permission level will permit access to Post metrics).
- Owned account: An X account linked to your X developer app.
- Public metrics: Totals that are available for anyone to access on X, such as the number of likes and number of Retweets.
- Non-public metrics: Totals not available for public viewing on X, such as the number of impressions and video view quartiles. Requires OAuth 2.0 or OAuth 1.0a user context authentication.
- Organic metrics: A grouping of public and non-public metrics attributed to an organic context (posted and viewed in a regular manner). Requires OAuth 2.0 or OAuth 1.0a user context authentication.
- Promoted metrics: A grouping of public and non-public metrics attributed to a promoted context (posted or viewed as part of an Ads campaign). Requires OAuth 2.0 or OAuth 1.0a user context authentication and that the Post was promoted in an Ad.
Available Metrics
Metric | API Representations | Description |
---|---|---|
Impressions | data.non_public_metrics.impression_count , data.organic_metrics.impression_count , data.promoted_metrics.impression_count | A count of how many times the Post has been viewed (not unique by user). A view is counted if any part of the Post is visible on the screen. Requires OAuth 1.0a User Context authentication. |
Retweets | data.public_metrics.retweet_count , data.organic_metrics.retweet_count , data.promoted_metrics.retweet_count | A count of how many times the Post has been Retweeted. Does not include Quote Tweets (“Retweets with comment”). To get the “Retweets and comments” total as displayed on X clients, add retweet_count and quote_count . |
Quote Tweets | data.public_metrics.quote_count | A count of how many times the Post has been Retweeted with a new comment (message). There are no Quote Tweets from a paid context, so all Quote Tweets are organic. |
Likes | data.public_metrics.like_count , data.organic_metrics.like_count , data.promoted_metrics.like_count | A count of how many times the Post has been liked. The public_metrics field returns the total count of likes from both organic and paid contexts to maintain consistency with counts shown publicly on X. |
Replies | data.public_metrics.reply_count , data.organic_metrics.reply_count , data.promoted_metrics.reply_count | A count of how many times the Post has been replied to. The public_metrics field returns the total count of replies from both organic and paid contexts. |
URL Link Clicks | data.non_public_metrics.url_link_clicks , data.organic_metrics.url_link_clicks , data.promoted_metrics.url_link_clicks | A count of the number of times a user clicks on a URL link or URL preview card in a Post. Requires OAuth 1.0a User Context authentication. |
User Profile Clicks | data.non_public_metrics.user_profile_clicks , data.organic_metrics.user_profile_clicks , data.promoted_metrics.user_profile_clicks | A count of the number of times a user clicks on portions of a Post: display name, user name, profile picture. Requires OAuth 1.0a User Context authentication. |
Video views | includes.media.public_metrics.view_count , includes.media.organic_metrics.view_count , includes.media.promoted_metrics.view_count | A count of how many times the video included in the Post has been viewed. This is the number of video views aggregated across all Posts in which the given video has been posted. Requires media expansion expansions=attachment.media_keys . |
Video view quartiles | includes.media.non_public_metrics.playback_0_count , includes.media.non_public_metrics.playback_25_count , includes.media.non_public_metrics.playback_50_count , includes.media.non_public_metrics.playback_75_count , includes.media.non_public_metrics.playback_100_count | The number of users who played through each quartile in a video. Requires OAuth 1.0a User Context authentication and media expansion expansions=attachment.media_keys . |
Requesting Metrics
Public Metrics
In the following request, we are requesting public metrics on the Post and on the attached video with the following fields and expansion. Be sure to replace $BEARER_TOKEN
with your own generated bearer token.
tweet.fields=public_metrics
expansions=attachments.media_keys&media.fields=public_metrics
Sample Request
Private Metrics (Non-public, Organic Metrics)
The following request asks for non-public metrics with additional details on organic metrics for the Post and attached video. Since these fields are private and not available for public view on X, the request requires OAuth 2.0 or OAuth 1.0a user context authentication. Refer to our guide for generating the OAuth 1.0a signature needed below.
tweet.fields=non_public_metrics,organic_metrics
expansions=attachments.media_keys&media.fields=non_public_metrics,organic_metrics