Migrating from standard v1.1's data format to v2
If you haven't already, we recommend that you read through the data formats migration introduction to start. You may also be interested in our visual data format migration tool to help you quickly see the differences between the Twitter API v1.1 data format and the Twitter API v2 format.
The standard v1.1 data format, also known as the native format, is the primary format that delivers with the standard v1.1 endpoints.
If you are using the premium product, please refer to the native enriched guide. Enterprise clients might be using native enriched or activity streams, depending on how you are set up within the Gnip console.
Standard v1.1 vs v2 payload structure
The following table displays the high-level objects and format that you can expect to receive from v2 compared to the v1.1 format.
v1.1 structure | v2 structure | |
Default | { ~all tweet object fields~, "entities": { "hashtags": [], "symbols": [], "user_mentions": [], "urls": [], "media": [] }, "extended_entities": {}, "user": {}, "place": {}, "retweeted_status/quoted_status" } |
{ "data": [{ "id", "text", "edit_history_tweet_ids" }] } |
With defined field and expansion parameters | { "data": [{ ~tweet object fields~, "entities": { "hashtags": [], "cashtags": [], "mentions": [], "urls": [], }, "attachments": { "media_keys": [], "poll_ids": [] } }], "includes": [ "tweets": [~tweet objects~], "users": [~user objects~], "media": [~media objects~], "places": [~place object~], "polls": [~poll object~] ], "matching_rules": [] } |
Field mapping
The following section describes which v1.1 fields map to v2 fields, as well as which v2 parameters are required to receive the new field.
Tweet object
Twitter 1.1 format |
Twitter v2 format |
Required v2 parameters |
created_at |
data.created_at |
tweet.fields=created_at |
id |
N/A id is a string |
|
id_str |
data.id |
default |
text |
data.text |
default |
full_text |
N/A text includes the complete text | |
truncated |
N/A text includes the complete text |
|
display_text_range |
N/A text includes the complete text |
|
edit_history | data.edit_history_tweet_ids | default |
edit_controls | data.edit_controls | tweet.fields=edit_controls |
editable | data.edit_controls.is_edit_eligible | tweet.fields=edit_controls |
entities |
data.entities |
tweet.fields=entities |
entities.user_mentions |
data.entities.mentions |
tweet.fields=entities |
entities.symbols |
data.entities.cashtags |
tweet.fields=entities |
entities.hashtags |
data.entities.hashtags |
tweet.fields=entities |
entities.urls |
data.entities.urls |
tweet.fields=entities |
entities.media |
includes.media |
expansions=attachments.media_keys |
extended_entities |
data.attachments |
tweet_fields=attachments |
in_reply_to_status_id |
N/A referenced_tweets.id is a string |
|
in_reply_to_status_id_str |
data.referenced_tweets.id (if type=replied_to) |
expansions=referenced_tweets.id |
in_reply_to_user_id |
N/A in_reply_to_user_id is a string |
|
in_reply_to_user_id_str |
data.in_reply_to_user_id |
tweet.fields=in_reply_to_user_id |
in_reply_to_screen_name |
includes.users..username | tweet.fields=in_reply_to_user_id&expansions=entities.mentions.username |
user |
includes.users |
expansions=author_id |
geo |
data.geo.place_id |
tweet.fields=geo |
coordinates |
data.geo.place_id |
expansions=geo.place_id |
place |
data.geo.place_id |
expansions=geo.place_id |
retweeted_status |
data.referenced_tweets.id (if type=retweeted) |
expansions=referenced_tweets.id |
is_quoted_status |
Not available |
|
quoted_status_id |
|
N/A referenced_tweets.id is a string |
quoted_status_id_str |
data.referenced_tweets.id (if type=quoted) |
expansions=referenced_tweets.id |
quoted_status_permalink |
Not Available | |
quoted_status |
data.referenced_tweets (if type=quoted) |
expansions=referenced_tweets.id |
retweet_count |
data.public_metrics.retweet_count |
tweet.fields=public_metrics |
favorite_count |
data.public_metrics.like_count |
tweet.fields=public_metrics |
favorited |
Not available |
|
retweeted |
Not available |
|
possibly_sensitive |
data.possibly_sensitive |
tweet.fields=possibly_sensitive |
lang |
data.lang |
tweet.fields=lang |
scopes |
Not available |
|
withheld |
data.withheld |
tweet.fields=withheld |
Example
Tweet object in 1.1 Example URI with parameters: https://api.x.com/1.1/statuses/lookup.json?id=1359554366051504129&tweet_mode=extended
|
Tweet object and request with v2 Example URI with parameters: https://api.x.com/2/tweets?ids=1359554366051504129&tweet.fields=attachments,author_id,context_annotations,conversation_id,created_at,entities,geo,id,in_reply_to_user_id,lang,possibly_sensitive,public_metrics,referenced_tweets,reply_settings,text,withheld |
{ "created_at": "Wed Feb 10 17:26:34 +0000 2021", "id": 1359554366051504129, "id_str": "1359554366051504129", "text": "Go ahead, follow another puppy account. We won’t judge. \n\nIntroducing the manage follows endpoints to the new… https:\/\/t.co\/3cBZKZUevF", "truncated": true, "entities": { "hashtags": [], "symbols": [], "user_mentions": [], "urls": [{ "url": "https:\/\/t.co\/3cBZKZUevF", "expanded_url": "https:\/\/twitter.com\/i\/web\/status\/1359554366051504129", "display_url": "twitter.com\/i\/web\/status\/1…", "indices": [ 111, 134 ] }] }, "in_reply_to_status_id": null, "in_reply_to_status_id_str": null, "in_reply_to_user_id": null, "in_reply_to_user_id_str": null, "in_reply_to_screen_name": null, "user": { ... }, "geo": null, "coordinates": null, "place": null, "contributors": null, "is_quote_status": false, "retweet_count": 18, "favorite_count": 98, "favorited": false, "retweeted": false, "possibly_sensitive": false, "possibly_sensitive_appealable": false, "lang": "en" } |
{ "data": [{ "id": "1359554366051504129", "text": "Go ahead, follow another puppy account. We won’t judge. \n\nIntroducing the manage follows endpoints to the new #TwitterAPI. You can now use the v2 API to follow and unfollow accounts. Learn more https://t.co/mtpd9VIMDa", "lang": "en", "conversation_id": "1359554366051504129", "possibly_sensitive": false, "reply_settings": "everyone", "created_at": "2021-02-10T17:26:34.000Z", "author_id": "2244994945", "public_metrics": { "retweet_count": 18, "reply_count": 11, "like_count": 98, "quote_count": 7 }, "entities": { "hashtags": [{ "start": 110, "end": 121, "tag": "TwitterAPI" }], "urls": [{ "start": 194, "end": 217, "url": "https://t.co/mtpd9VIMDa", "expanded_url": "https://twittercommunity.com/t/introducing-the-new-manage-follows-endpoints-to-the-twitter-api-v2/149465", "display_url": "twittercommunity.com/t/introducing-…", "images": [{ "url": "https://pbs.twimg.com/news_img/1359554367905427457/DczC72__?format=jpg&name=orig", "width": 1200, "height": 630 }, { "url": "https://pbs.twimg.com/news_img/1359554367905427457/DczC72__?format=jpg&name=150x150", "width": 150, "height": 150 } ], "status": 200, "title": "Introducing the new manage follows endpoints to the Twitter API v2", "description": "To follow, or not to follow? You’re now free to answer that question however you like using the Twitter API v2. Today, we’re excited to announce the release of the new manage follows endpoints into the new Twitter API. As teased when we launched the follows lookup endpoints a little over a month ago, the ability to manage follow relationships is finally here. These are some of our most popular endpoints on our v1.1 APIs, so we’re excited to unlock a wide range of use cases on Twitter API v2. W...", "unwound_url": "https://twittercommunity.com/t/introducing-the-new-manage-follows-endpoints-to-the-twitter-api-v2/149465" }] }, "context_annotations": [{ "domain": { "id": "46", "name": "Brand Category", "description": "Categories within Brand Verticals that narrow down the scope of Brands" }, "entity": { "id": "781974596752842752", "name": "Services" } }, { "domain": { "id": "47", "name": "Brand", "description": "Brands and Companies" }, "entity": { "id": "10045225402", "name": "Twitter" } } ] }] } |
User object
Twitter 1.1 format |
Twitter v2 format |
Required v2 parameters |
user_id |
data.author_id |
tweet.fields=author_id |
user.id |
|
N/A use includes.users.id |
user.id_str |
includes.users.id |
expansions=author_id |
user.name |
includes.users.name |
expansions=author_id |
user.screen_name |
includes.user.username |
expansions=author_id |
user.location |
includes.users.location |
expansions=author_id&user.fields=location |
user.description |
includes.users.description |
expansions=author_id&user.fields=description |
user.url |
includes.users.url |
expansions=author_id&user.fields=entities |
user.entities |
includes.users.entities | |
user.entities.url.urls.url |
includes.users.entities.url.urls.url | |
user.entities.url.urls.expanded_url |
includes.users.entities.url.urls.expanded_url |
expansions=author_id&user.fields=entities |
user.entities.url.urls.display_url |
includes.users.entities.url.urls.display_url |
expansions=author_id&user.fields=entities |
user.entities.url.urls.display_url.indicies[0] |
includes.users.entities.url.urls.start |
expansions=author_id&user.fields=entities |
user.entities.url.urls.display_url.indicies[1] |
includes.users.entities.url.urls.end |
expansions=author_id&user.fields=entities |
user.protected |
includes.users.protected |
expansions=author_id&user.fields=protected |
user.followers_count |
includes.users.public_metrics.followers_count |
expansions=author_id&user.fields=public_metrics |
user.friends_count |
includes.users.public_metrics.following_count |
expansions=author_id&user.fields=public_metrics |
user.listed_count |
includes.users.public_metrics.listed_count |
expansions=author_id&user.fields=public_metrics |
user.created_at |
includes.users.created_at |
expansions=author_id&user.fields=created_at |
user.favourites_count |
|
|
user.verified |
includes.users.verified |
expansions=author_id&user.fields=verified |
user.statuses_count |
includes.users.public_metrics.tweet_count |
expansions=author_id&user.fields=public_metrics |
user.profile_image_url_https |
includes.users.profile_image_url |
expansions=author_id&user.fields=profile_image_url |
Example
User object in 1.1 | User object and request with v2 |
"user": { "id": 2244994945, "id_str": "2244994945", "name": "Twitter Dev", "screen_name": "TwitterDev", "location": "127.0.0.1", "description": "The voice of the #TwitterDev team and your official source for updates, news, and events, related to the #TwitterAPI.", "url": "https:\/\/t.co\/3ZX3TNiZCY", "entities": { "url": { "urls": [{ "url": "https:\/\/t.co\/3ZX3TNiZCY", "expanded_url": "https:\/\/developer.twitter.com\/en\/community", "display_url": "developer.twitter.com\/en\/community", "indices": [ 0, 23 ] }] }, "description": { "urls": [] } }, "protected": false, "followers_count": 517232, "friends_count": 2032, "listed_count": 1722, "created_at": "Sat Dec 14 04:35:55 +0000 2013", "favourites_count": 2134, "utc_offset": null, "time_zone": null, "geo_enabled": true, "verified": true, "statuses_count": 3677, "lang": null, "contributors_enabled": false, "is_translator": false, "is_translation_enabled": false, "profile_background_color": "FFFFFF", "profile_background_image_url": "http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png", "profile_background_image_url_https": "https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png", "profile_background_tile": false, "profile_image_url": "http:\/\/pbs.twimg.com\/profile_images\/1354494203451961345\/d8HkZl6p_normal.jpg", "profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/1354494203451961345\/d8HkZl6p_normal.jpg", "profile_banner_url": "https:\/\/pbs.twimg.com\/profile_banners\/2244994945\/1611792896", "profile_link_color": "0084B4", "profile_sidebar_border_color": "FFFFFF", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": false, "has_extended_profile": true, "default_profile": false, "default_profile_image": false, "following": null, "follow_request_sent": null, "notifications": null, "translator_type": "regular" } |
{ "data": [{ "author_id": "2244994945", "id": "1362876655061073928", "text": "From our living rooms to yours 🐱💻🛋️Our developer advocates have some exciting Twitch streams and virtual events planned to help you get started with the new #TwitterAPI. Check out the schedule for details, and let us know if you want to see more!\n👇\nhttps://t.co/cixDY9qkvH" }], "includes": { "users": [{ "public_metrics": { "followers_count": 517233, "following_count": 2034, "tweet_count": 3677, "listed_count": 1727 }, "username": "TwitterDev", "entities": { "url": { "urls": [{ "start": 0, "end": 23, "url": "https://t.co/3ZX3TNiZCY", "expanded_url": "https://developer.twitter.com/en/community", "display_url": "developer.twitter.com/en/community" }] }, "description": { "hashtags": [{ "start": 17, "end": 28, "tag": "TwitterDev" }, { "start": 105, "end": 116, "tag": "TwitterAPI" } ] } }, "description": "The voice of the #TwitterDev team and your official source for updates, news, and events, related to the #TwitterAPI.", "name": "Twitter Dev", "verified": true, "location": "127.0.0.1", "id": "2244994945", "protected": false, "url": "https://t.co/3ZX3TNiZCY", "profile_image_url": "https://pbs.twimg.com/profile_images/1354494203451961345/d8HkZl6p_normal.jpg", "created_at": "2013-12-14T04:35:55.000Z" }] } } |
Entities and expanded entities objects
Twitter 1.1 format |
Twitter v2 format |
Required v2 parameters |
Type in v2 |
entities |
data.entities |
tweet.fields=entities |
object |
entities.hashtags |
data.entities.hashtags |
tweet.fields=entities |
array of objects |
entities.hashtags.indices[0] |
data.entities.hashtags.start |
tweet.fields=entities |
number |
entities.hashtags.indices[1] |
data.entities.hashtags.end |
tweet.fields=entities |
number |
entities.hashtags.text |
data.entities.hashtags.tag |
tweet.fields=entities |
string |
entities.urls |
data.entities.urls |
tweet.fields=entities |
array of objects |
entities.urls.indices[0] |
data.entities.urls.start |
tweet.fields=entities |
number |
entities.urls.indices[1] |
data.entities.urls.end |
tweet.fields=entities |
number |
entities.urls.url |
data.entities.urls.url |
tweet.fields=entities |
string |
entities.user_mentions |
data.entities.mentions |
tweet.fields=entities |
array of objects |
entities.user_mentions.indicies[0] |
data.entities.mentions.start |
tweet.fields=entities |
number |
entities.user_mentions.indicies[1] |
data.entities.mentions.end |
tweet.fields=entities |
number |
entities.user_mentions.screen_name |
data.entities.mentions.username |
tweet.fields=entities |
string |
entities.symbols |
data.entities.cashtags |
tweet.fields=entities |
array of objects |
entities.symbols.indices[0] |
data.entities.cashtags.start |
tweet.fields=entities |
number |
entities.symbols.indices[1] |
data.entities.cashtags.end |
tweet.fields=entities |
number |
entities.symbols.text |
data.entities.cashtags.tag |
tweet.fields=entities |
string |
entities.media |
includes.media |
expansions=attachments.media_keys |
array of objects |
entities.media.id_str |
includes.media.media_key |
expansions=attachments.media_keys |
string |
entities.media.type |
includes.media.media.type |
expansions=attachments.media_keys |
string |
entities.media.media_url |
|
N/A use includes.media.url |
string |
entities.media.media_url_https |
includes.media.url |
expansions=attachments.media_keys&media.fields=url |
string |
entities.media.url |
|||
entities.media.display_url |
|||
entities.media.expanded_url |
|||
entities.media.media_url_https |
includes.media.preview_image_url |
expansions=attachments.media_keys&media.fields=preview_image_url |
string |
extended_entities |
data.attachments |
tweet_fields=attachments |
object |
extended_entities |
data.attachments.media_keys |
tweet.fields=attachments |
array of objects |
extended_entities.media |
includes.media |
expansions=attachments.media_keys |
array of objects |
extended_entities.media.id_str |
includes.media.media_key |
expansions=attachments.media_keys |
string |
extended_entities.media.type |
includes.media.media.type |
expansions=attachments.media_keys |
string |
extended_entities.media.sizes.thumb.w |
Not Available |
||
extended_entities.media.sizes.thumb.h |
|
Not Available |
|
extended_entities.media.sizes.thumb.resize |
|
Not Available |
|
extended_entities.media.sizes.large.w |
includes.media.height |
expansions=attachments.media_keys&media.fields=height |
|
extended_entities.media.sizes.large.h |
includes.media.width |
expansions=attachments.media_keys&media.fields=width |
|
extended_entities.media.sizes.large.resize |
|
Not Available |
|
extended_entities.media.sizes.small.w |
|
Not Available |
|
extended_entities.media.sizes.small.h |
|
Not Available |
|
extended_entities.media.sizes.small.resize |
|
Not Available |
|
extended_entities.media.sizes.medium.w |
|
Not Available |
|
extended_entities.media.sizes.medium.h |
|
Not Available |
|
extended_entities.media.sizes.medium.resize |
|
Not Available |
|
extended_entities.media.media_url_https |
includes.media.url |
expansions=attachments.media_keys&media.fields=url |
string |
extended_entities.media.media_url_https |
includes.media.preview_image_url |
expansions=attachments.media_keys&media.fields=preview_image_url |
string |
extended_entities.media.video_info.duration_millis |
includes.media.duration_ms |
expansions=attachments.media_keys&media.fields=duration_ms |
number |
Example
Entities and extended entities in v1.1 (with video) |
Entities, attachments and includes in v2 https://api.x.com/2/tweets?ids=1370161532013735937&expansions=attachments.media_keys,entities.mentions.username&tweet.fields=entities&user.fields=created_at,description,entities,location,name,profile_image_url,protected,public_metrics,url,username,verified,withheld&media.fields=duration_ms,height,media_key,preview_image_url,public_metrics,type,url,width |
"entities": { "hashtags": [{ "text": "test", "indices": [ 8, 13 ] }], "symbols": [], "user_mentions": [{ "screen_name": "TwitterDev", "name": "Twitter Dev", "id": 2244994945, "id_str": "2244994945", "indices": [ 31, 42 ] }], "urls": [{ "url": "https:\/\/t.co\/XVLZ3uwikc", "expanded_url": "https:\/\/developer.twitter.com\/en", "display_url": "developer.twitter.com\/en", "indices": [ 91, 114 ] }], "media": [{ "id": 1370161464028196868, "id_str": "1370161464028196868", "indices": [ 115, 138 ], "media_url": "http:\/\/pbs.twimg.com\/ext_tw_video_thumb\/1370161464028196868\/pu\/img\/cGLCoXBHVktkwlC5.jpg", "media_url_https": "https:\/\/pbs.twimg.com\/ext_tw_video_thumb\/1370161464028196868\/pu\/img\/cGLCoXBHVktkwlC5.jpg", "url": "https:\/\/t.co\/dz4oByygWA", "display_url": "pic.twitter.com\/dz4oByygWA", "expanded_url": "https:\/\/twitter.com\/furiouscamper\/status\/1370161532013735937\/video\/1", "type": "photo", "sizes": { "thumb": { "w": 150, "h": 150, "resize": "crop" }, "small": { "w": 383, "h": 680, "resize": "fit" }, "large": { "w": 720, "h": 1280, "resize": "fit" }, "medium": { "w": 675, "h": 1200, "resize": "fit" } } }] }, "extended_entities": { "media": [{ "id": 1370161464028196868, "id_str": "1370161464028196868", "indices": [ 115, 138 ], "media_url": "http:\/\/pbs.twimg.com\/ext_tw_video_thumb\/1370161464028196868\/pu\/img\/cGLCoXBHVktkwlC5.jpg", "media_url_https": "https:\/\/pbs.twimg.com\/ext_tw_video_thumb\/1370161464028196868\/pu\/img\/cGLCoXBHVktkwlC5.jpg", "url": "https:\/\/t.co\/dz4oByygWA", "display_url": "pic.twitter.com\/dz4oByygWA", "expanded_url": "https:\/\/twitter.com\/furiouscamper\/status\/1370161532013735937\/video\/1", "type": "video", "sizes": { "thumb": { "w": 150, "h": 150, "resize": "crop" }, "small": { "w": 383, "h": 680, "resize": "fit" }, "large": { "w": 720, "h": 1280, "resize": "fit" }, "medium": { "w": 675, "h": 1200, "resize": "fit" } }, "video_info": { "aspect_ratio": [ 9, 16 ], "duration_millis": 5140, "variants": [{ "bitrate": 950000, "content_type": "video\/mp4", "url": "https:\/\/video.twimg.com\/ext_tw_video\/1370161464028196868\/pu\/vid\/480x852\/rAuFVMEqs0MeP4P4.mp4?tag=12" }, { "bitrate": 2176000, "content_type": "video\/mp4", "url": "https:\/\/video.twimg.com\/ext_tw_video\/1370161464028196868\/pu\/vid\/720x1280\/ZxVL5qYO-DNVuSyq.mp4?tag=12" }, { "content_type": "application\/x-mpegURL", "url": "https:\/\/video.twimg.com\/ext_tw_video\/1370161464028196868\/pu\/pl\/EGVpuZpo-wYxTNCq.m3u8?tag=12" }, { "bitrate": 632000, "content_type": "video\/mp4", "url": "https:\/\/video.twimg.com\/ext_tw_video\/1370161464028196868\/pu\/vid\/320x568\/M7VtocAwKPFdkqzF.mp4?tag=12" } ] }, "additional_media_info": { "monetizable": false } }] } |
{ "data": [{ "entities": { "hashtags": [{ "start": 8, "end": 13, "tag": "test" }], "mentions": [{ "start": 31, "end": 42, "username": "TwitterDev" }], "urls": [{ "start": 91, "end": 114, "url": "https://t.co/XVLZ3uwikc", "expanded_url": "https://developer.twitter.com/en", "display_url": "developer.twitter.com/en", "status": 200, "title": "Use Cases, Tutorials, & Documentation", "description": "Publish & analyze Tweets, optimize ads, & create unique customer experiences with the Twitter API, Twitter Ads API, & Twitter for Websites. Let's start building.", "unwound_url": "https://developer.twitter.com/en" }, { "start": 115, "end": 138, "url": "https://t.co/dz4oByygWA", "expanded_url": "https://twitter.com/furiouscamper/status/1370161532013735937/video/1", "display_url": "pic.twitter.com/dz4oByygWA" } ] }, "id": "1370161532013735937", "text": "Another #test with a video and @TwitterDev mention. Excited for new format migration docs! https://t.co/XVLZ3uwikc https://t.co/dz4oByygWA", "attachments": { "media_keys": [ "7_1370161464028196868" ] } }], "includes": { "media": [{ "type": "video", "height": 1280, "public_metrics": { "view_count": 37 }, "width": 720, "media_key": "7_1370161464028196868", "duration_ms": 5140, "preview_image_url": "https://pbs.twimg.com/ext_tw_video_thumb/1370161464028196868/pu/img/cGLCoXBHVktkwlC5.jpg" }], "users": [{ "public_metrics": { "followers_count": 517233, "following_count": 2034, "tweet_count": 3677, "listed_count": 1727 }, "created_at": "2013-12-14T04:35:55.000Z", "profile_image_url": "https://pbs.twimg.com/profile_images/1354494203451961345/d8HkZl6p_normal.jpg", "description": "The voice of the #TwitterDev team and your official source for updates, news, and events, related to the #TwitterAPI.", "verified": true, "id": "2244994945", "username": "TwitterDev", "protected": false, "entities": { "url": { "urls": [{ "start": 0, "end": 23, "url": "https://t.co/3ZX3TNiZCY", "expanded_url": "https://developer.twitter.com/en/community", "display_url": "developer.twitter.com/en/community" }] }, "description": { "hashtags": [{ "start": 17, "end": 28, "tag": "TwitterDev" }, { "start": 105, "end": 116, "tag": "TwitterAPI" } ] } }, "url": "https://t.co/3ZX3TNiZCY", "name": "Twitter Dev", "location": "127.0.0.1" }] } } |
Place object
Twitter 1.1 format |
Twitter v2 format |
Required v2 parameters |
place |
data.geo.place_id |
tweet.fields=geo |
place.id |
includes.places.id |
expansions=geo.place_id |
place.id.place_type |
includes.places.place_type |
expansions=geo.place_id&place.fields=place_type |
place.id.name |
includes.places.name |
expansions=geo.place_id&place.fields=name |
place.id.full_name |
includes.places.full_name |
expansions=geo.place_id |
place.id.country_code |
includes.places.country_code |
expansions=geo.place_id&place.fields=country_code |
place.id.country |
includes.places.country |
expansions=geo.place_id&place.fields=country |
place.id.contained_within |
includes.places.contained_within |
expansions=geo.place_id&place.fields=contained_within |
place.id.bounding_box.type |
includes.places.geo.type |
expansions=geo.place_id&place.fields=place_type |
place.id.bounding_box.coordinates |
includes.places.geo.bbox |
expansions=geo.place_id&place.fields=geo |
place.id.attributes |
includes.places.properties |
expansions=geo.place_id&place.fields=geo |
Example
Place object in v1.1 |
Place object with v2 https://api.x.com/2/tweets?ids=1370161532013735937&expansions=geo.place_id&tweet.fields=geo&place.fields=contained_within,country,country_code,full_name,geo,id,name,place_type |
"place": { "id": "f7eb2fa2fea288b1", "url": "https:\/\/api.x.com\/1.1\/geo\/id\/f7eb2fa2fea288b1.json", "place_type": "city", "name": "Lakewood", "full_name": "Lakewood, CO", "country_code": "US", "country": "United States", "contained_within": [], "bounding_box": { "type": "Polygon", "coordinates": [ [ [ -105.193475, 39.60973 ], [ -105.053164, 39.60973 ], [ -105.053164, 39.761974 ], [ -105.193475, 39.761974 ] ] ] }, "attributes": {} } |
{ "data": [{ "id": "1370161532013735937", "text": "Another #test with a video and @TwitterDev mention. Excited for new format migration docs! https://t.co/XVLZ3uwikc https://t.co/dz4oByygWA", "geo": { "place_id": "f7eb2fa2fea288b1" } }], "includes": { "places": [{ "name": "Lakewood", "place_type": "city", "full_name": "Lakewood, CO", "id": "f7eb2fa2fea288b1", "geo": { "type": "Feature", "bbox": [ -105.193475, 39.60973, -105.053164, 39.761974 ], "properties": {} }, "country_code": "US", "country": "United States" }] } |
Next step
- Learn more about fields
- Learn more about expansions
- Learn how to use fields with expansions