Skip to main content

Retrieve tweet details

Unique ID

Based on the tweet ID, you can use the Twitter API to retrieve the details:

Command
curl -L -X GET 'https://api.twitter.com/2/tweets/<tweet ID>?tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=author_id&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld' \
-H 'Authorization: Bearer ***'

In this sample, we extract:

  • All public fields and metrics available on the tweet.
  • We expand the author details (with the expansions parameter).
  • All available author fields expanded.

You can retrieve all details on Twitter developer portal: https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference/get-tweets-id

Response
{
"data": {
"reply_settings": "everyone",
"id": "1602876220294955010",
"public_metrics": {
"retweet_count": 711,
"reply_count": 312,
"like_count": 3038,
"quote_count": 101,
"impression_count": 0
},
"conversation_id": "1602876220294955010",
"context_annotations": [
{
"domain": {
"id": "46",
"name": "Business Taxonomy",
"description": "Categories within Brand Verticals that narrow down the scope of Brands"
},
"entity": {
"id": "1557696420500541440",
"name": "Automotive, Aircraft & Boat Business",
"description": "Brands, companies, advertisers and every non-person handle with the profit intent related to automobile, spacecraft, aircraft and boat manufacturing"
}
},
{
"domain": {
"id": "46",
"name": "Business Taxonomy",
"description": "Categories within Brand Verticals that narrow down the scope of Brands"
},
"entity": {
"id": "1557696848252391426",
"name": "Financial Services Business",
"description": "Brands, companies, advertisers and every non-person handle with the profit intent related to Banks, Credit cards, Insurance, Investments, Stocks "
}
},
{
"domain": {
"id": "46",
"name": "Business Taxonomy",
"description": "Categories within Brand Verticals that narrow down the scope of Brands"
},
"entity": {
"id": "1557697333571112960",
"name": "Technology Business",
"description": "Brands, companies, advertisers and every non-person handle with the profit intent related to softwares, apps, communication equipments, hardwares"
}
},
{
"domain": {
"id": "69",
"name": "News Vertical",
"description": "News Categories like Entertainment or Technology"
},
"entity": {
"id": "1046545033657081857",
"name": "News",
"description": "News"
}
},
{
"domain": {
"id": "69",
"name": "News Vertical",
"description": "News Categories like Entertainment or Technology"
},
"entity": {
"id": "1585285924069335040",
"name": "Business & finance news"
}
},
{
"domain": {
"id": "131",
"name": "Unified Twitter Taxonomy",
"description": "A taxonomy of user interests. "
},
"entity": {
"id": "840160819388141570",
"name": "Tech news",
"description": "Tech News"
}
},
{
"domain": {
"id": "131",
"name": "Unified Twitter Taxonomy",
"description": "A taxonomy of user interests. "
},
"entity": {
"id": "848920371311001600",
"name": "Technology",
"description": "Technology and computing"
}
},
{
"domain": {
"id": "131",
"name": "Unified Twitter Taxonomy",
"description": "A taxonomy of user interests. "
},
"entity": {
"id": "1046545033657081857",
"name": "News",
"description": "News"
}
},
{
"domain": {
"id": "131",
"name": "Unified Twitter Taxonomy",
"description": "A taxonomy of user interests. "
},
"entity": {
"id": "1585285924069335040",
"name": "Business & finance news"
}
},
{
"domain": {
"id": "10",
"name": "Person",
"description": "Named people in the world like Nelson Mandela"
},
"entity": {
"id": "808713037230157824",
"name": "Elon Musk",
"description": "Elon Musk"
}
},
{
"domain": {
"id": "30",
"name": "Entities [Entity Service]",
"description": "Entity Service top level domain, every item that is in Entity Service should be in this domain"
},
"entity": {
"id": "781972125179518977",
"name": "Auto Manufacturer - Auto"
}
},
{
"domain": {
"id": "30",
"name": "Entities [Entity Service]",
"description": "Entity Service top level domain, every item that is in Entity Service should be in this domain"
},
"entity": {
"id": "781974596752842752",
"name": "Services"
}
},
{
"domain": {
"id": "47",
"name": "Brand",
"description": "Brands and Companies"
},
"entity": {
"id": "10044199219",
"name": "Tesla Motors"
}
},
{
"domain": {
"id": "47",
"name": "Brand",
"description": "Brands and Companies"
},
"entity": {
"id": "10045225402",
"name": "Twitter"
}
},
{
"domain": {
"id": "65",
"name": "Interests and Hobbies Vertical",
"description": "Top level interests and hobbies groupings, like Food or Travel"
},
"entity": {
"id": "781974596148793345",
"name": "Business & finance"
}
},
{
"domain": {
"id": "65",
"name": "Interests and Hobbies Vertical",
"description": "Top level interests and hobbies groupings, like Food or Travel"
},
"entity": {
"id": "847528391163092993",
"name": "Automotive",
"description": "Car culture"
}
},
{
"domain": {
"id": "66",
"name": "Interests and Hobbies Category",
"description": "A grouping of interests and hobbies entities, like Novelty Food or Destinations"
},
"entity": {
"id": "847528576551337984",
"name": "Hybrid and electric vehicles",
"description": "Hybrid and electric vehicles"
}
},
{
"domain": {
"id": "66",
"name": "Interests and Hobbies Category",
"description": "A grouping of interests and hobbies entities, like Novelty Food or Destinations"
},
"entity": {
"id": "847528646185070592",
"name": "Luxury Cars",
"description": "Luxury"
}
},
{
"domain": {
"id": "66",
"name": "Interests and Hobbies Category",
"description": "A grouping of interests and hobbies entities, like Novelty Food or Destinations"
},
"entity": {
"id": "857878777191211008",
"name": "Leadership",
"description": "Leadership"
}
},
{
"domain": {
"id": "131",
"name": "Unified Twitter Taxonomy",
"description": "A taxonomy of user interests. "
},
"entity": {
"id": "10044199219",
"name": "Tesla Motors"
}
},
{
"domain": {
"id": "131",
"name": "Unified Twitter Taxonomy",
"description": "A taxonomy of user interests. "
},
"entity": {
"id": "847528391163092993",
"name": "Automotive",
"description": "Car culture"
}
},
{
"domain": {
"id": "131",
"name": "Unified Twitter Taxonomy",
"description": "A taxonomy of user interests. "
},
"entity": {
"id": "1196845866138533888",
"name": "Automobile Brands"
}
}
],
"created_at": "2022-12-14T04:00:45.000Z",
"entities": {
"annotations": [
{
"start": 38,
"end": 42,
"probability": 0.9851,
"type": "Organization",
"normalized_text": "Tesla"
},
{
"start": 122,
"end": 130,
"probability": 0.976,
"type": "Person",
"normalized_text": "Elon Musk"
},
{
"start": 163,
"end": 169,
"probability": 0.9701,
"type": "Other",
"normalized_text": "Twitter"
}
],
"urls": [
{
"start": 239,
"end": 262,
"url": "https://t.co/VzG7xLDQsi",
"expanded_url": "https://boingboing.net/2022/12/12/tesla-is-on-the-way-to-becoming-the-mypillow-of-cars.html",
"display_url": "boingboing.net/2022/12/12/tes…",
"images": [
{
"url": "https://pbs.twimg.com/news_img/1610412998446944256/CBHJrSsh?format=jpg&name=orig",
"width": 640,
"height": 426
},
{
"url": "https://pbs.twimg.com/news_img/1610412998446944256/CBHJrSsh?format=jpg&name=150x150",
"width": 150,
"height": 150
}
],
"status": 200,
"title": "Tesla is on the way to becoming the MyPillow of cars | Boing Boing",
"description": "Several surveys show the once darling Tesla has slipped into the realm of negative brand perception. It would appear that Elon Musk’s antics since his purchase of Twitter have also caused peo…",
"unwound_url": "https://boingboing.net/2022/12/12/tesla-is-on-the-way-to-becoming-the-mypillow-of-cars.html"
}
]
},
"author_id": "2316383071",
"text": "Several surveys show the once darling Tesla has slipped into the realm of negative brand perception. It would appear that Elon Musk's antics since his purchase of Twitter have also caused people to sour on his other brands.\n\nImagine that.\nhttps://t.co/VzG7xLDQsi",
"lang": "en",
"edit_history_tweet_ids": ["1602876220294955010"],
"edit_controls": {
"edits_remaining": 5,
"is_edit_eligible": true,
"editable_until": "2022-12-14T04:30:45.000Z"
}
},
"includes": {
"users": [
{
"created_at": "2014-01-29T02:27:58.000Z",
"description": "~@rvawonk@newsie.social~ Behavioral Scientist. Postdoc @ UMD. Studying disinformation, cognitive security, mediated communication, crises. Opinions are mine.",
"id": "2316383071",
"profile_image_url": "https://pbs.twimg.com/profile_images/1590761552025624576/USILJCTg_normal.jpg",
"name": "Caroline Orr Bueno, Ph.D",
"pinned_tweet_id": "1591557768934486017",
"public_metrics": {
"followers_count": 454303,
"following_count": 3044,
"tweet_count": 107252,
"listed_count": 4248
},
"protected": false,
"verified": false,
"entities": {
"url": {
"urls": [
{
"start": 0,
"end": 23,
"url": "https://t.co/TunM9nILSl",
"expanded_url": "https://medium.com/@RVAwonk",
"display_url": "medium.com/@RVAwonk"
}
]
}
},
"url": "https://t.co/TunM9nILSl",
"username": "RVAwonk"
}
]
}
}
note

The author is identified as a user in Twitter.

Retrieve a batch of tweets

It is possible to pass a list of tweet IDs (up to 100) within 1 call. To do so, you need to add an additional URL parameter: ids with the list of IDs separated by a comma.

The rest of the parameters remains unchanged:

Command
curl -L -X GET 'https://api.twitter.com/2/tweets?ids=1602876220294955010,1611398584221724673&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,edit_history_tweet_ids,entities,geo,id,in_reply_to_user_id,lang,public_metrics,referenced_tweets,reply_settings,source,text,withheld&expansions=author_id&user.fields=created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld' \
-H 'Authorization: Bearer ***'

The structure of the response doesn't change with the unique ID endpoint, it's just an array of data and an array of users that is returned.

You can retrieve all details on Twitter developer portal: https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference/get-tweets