Entities

Entities provide metadata and additional contextual information about content posted on Twitter. Entities are never divorced from the content they describe. Entities are returned wherever Tweets are found in the API. Entities are instrumental in resolving URLs.

Read Entities in Objects for a more comprehensive guide to how entities are used throughout Twitter objects.

Field Guide

Consumers of Entities should tolerate the addition of new fields and variance in ordering of fields with ease. Not all fields appear in all contexts. It is generally safe to consider a nulled field, an empty set, and the absence of a field as the same thing.

Field Type Description
hashtags Array of Object

Represents hashtags which have been parsed out of the Tweet text. Example:

"hashtags":[{"indices":[32,36],"text":"lol"}]
media Array of Object

Represents media elements uploaded with the Tweet. Example:

"media":[{"type":"photo", "sizes":{"thumb":{"h":150, "resize":"crop", "w":150}, "large":{"h":238, "resize":"fit", "w":226},
"medium":{"h":238, "resize":"fit", "w":226}, "small":{"h":238, "resize":"fit", "w":226}}, "indices":[15,35],
"url":"http:\/\/t.co\/rJC5Pxsu", "media_url":"http:\/\/p.twimg.com\/AZVLmp-CIAAbkyy.jpg",
"display_url":"pic.twitter.com\/rJC5Pxsu","id":114080493040967680, "id_str":"114080493040967680", "expanded_url":
"http:\/\/twitter.com\/yunorno\/status\/114080493036773378\/photo\/1",
"media_url_https":"https:\/\/p.twimg.com\/AZVLmp-CIAAbkyy.jpg"}]
urls Array of Object

Represents URLs included in the text of a Tweet or within textual fields of a user object . Tweet Example:

"urls":[{"indices":[32,52], "url":"http:\/\/t.co\/IOwBrTZR", "display_url":"youtube.com\/watch?v=oHg5SJ\u2026",
"expanded_url":"http:\/\/www.youtube.com\/watch?v=oHg5SJYRHA0"}]

User Example:

 "urls":[{"indices":[32,52], "url":"http:\/\/t.co\/IOwBrTZR", "display_url":"youtube.com\/watch?v=oHg5SJ\u2026", "expanded_url"
:"http:\/\/www.youtube.com\/watch?v=oHg5SJYRHA0"}]
user_mentions Array of Object

Represents other Twitter users mentioned in the text of the Tweet. Example:

"user_mentions":[{"name":"Twitter API", "indices":[4,15], "screen_name":"twitterapi", "id":6253282, "id_str":"6253282"}]

Hashtags

Field Type Description
indices Array of Int

An array of integers indicating the offsets within the Tweet text where the hashtag begins and ends. The first integer represents the location of the # character in the Tweet text string. The second integer represents the location of the first character after the hashtag. Therefore the difference between the two numbers will be the length of the hashtag name plus one (for the ‘#’ character). Example:

"indices":[32,36]
text String

Name of the hashtag, minus the leading ‘#’ character. Example:

"text":"lol"

Media

Field Type Description
display_url String

URL of the media to display to clients. Example:

"display_url":"pic.twitter.com\/rJC5Pxsu"
expanded_url String

An expanded version of display_url. Links to the media display page. Example:

"expanded_url": "http:\/\/twitter.com\/yunorno\/status\/114080493036773378\/photo\/1"
id Int64

ID of the media expressed as a 64-bit integer. Example:

"id":114080493040967680
id_str String

ID of the media expressed as a string. Example:

"id_str":"114080493040967680"
indices Array of Int

An array of integers indicating the offsets within the Tweet text where the URL begins and ends. The first integer represents the location of the first character of the URL in the Tweet text. The second integer represents the location of the first non-URL character occurring after the URL (or the end of the string if the URL is the last part of the Tweet text). Example:

"indices":[15,35]
media_url String

An http:// URL pointing directly to the uploaded media file. Example:

"media_url":"http:\/\/p.twimg.com\/AZVLmp-CIAAbkyy.jpg"

For media in direct messages, media_url is the same https URL as media_url_https and must be accessed via an authenticated twitter.com session or by signing a request with the user’s access token using OAuth 1.0A. It is not possible to directly embed these images in a web page.

media_url_https String

An https:// URL pointing directly to the uploaded media file, for embedding on https pages. Example:

"media_url_https":"https:\/\/p.twimg.com\/AZVLmp-CIAAbkyy.jpg"

For media in direct messages, media_url_https must be accessed via an authenticated twitter.com session or by signing a request with the user’s access token using OAuth 1.0A. It is not possible to directly embed these images in a web page.

sizes Object

An object showing available sizes for the media file. Example:

"sizes":{"thumb":{"h":150, "resize":"crop", "w":150}, "large":{"h":238, "resize":"fit", "w":226}, "medium":{"h":238, "resize":
"fit", "w":226}, "small":{"h":238, "resize":"fit", "w":226}}
source_status_id Int64

For Tweets containing media that was originally associated with a different tweet, this ID points to the original Tweet. Example:

"source_status_id": 205282515685081088
source_status_id_str Int64

For Tweets containing media that was originally associated with a different tweet, this string-based ID points to the original Tweet. Example:

"source_status_id_str": "205282515685081088"
type String

Type of uploaded media. Example:

"type":"photo"
url String

Wrapped URL for the media link. This corresponds with the URL embedded directly into the raw Tweet text, and the values for the indices parameter. Example:

"url":"http:\/\/t.co\/rJC5Pxsu"

Size

Field Type Description
h Int

Height in pixels of this size. Example:

"h":150
resize String

Resizing method used to obtain this size. A value of fit``means that the media was resized to fit one dimension, keeping its native aspect ratio. A value of ``crop means that the media was cropped in order to fit a specific resolution. Example:

"resize":"crop"
w Int

Width in pixels of this size. Example:

"w":150

Sizes

Field Type Description
thumb Object

Information for a thumbnail-sized version of the media. Example:

"thumb":{"h":150, "resize":"crop", "w":150}
large Object

Information for a large-sized version of the media. Example:

"large":{"h":238, "resize":"fit", "w":226}
medium Object

Information for a medium-sized version of the media. Example:

"medium":{"h":238, "resize":"fit", "w":226}
small Object

Information for a small-sized version of the media. Example:

"small":{"h":238, "resize":"fit", "w":226}

URL

Field Type Description
display_url String

Version of the URL to display to clients. Example:

"display_url":"youtube.com\/watch?v=oHg5SJ\u2026"
expanded_url String

Expanded version of `` display_url`` . Example:

"expanded_url":"http:\/\/www.youtube.com\/watch?v=oHg5SJYRHA0"
indices Array of Int

An array of integers representing offsets within the Tweet text where the URL begins and ends. The first integer represents the location of the first character of the URL in the Tweet text. The second integer represents the location of the first non-URL character after the end of the URL. Example:

"indices":[32,52]
url String

Wrapped URL, corresponding to the value embedded directly into the raw Tweet text, and the values for the .. code:: javascript

indices

parameter. Example:

"url":"http:\/\/t.co\/IOwBrTZR"

User Mention

Field Type Description
id Int64

ID of the mentioned user, as an integer. Example:

"id":6253282
id_str String

If of the mentioned user, as a string. Example:

"id_str":"6253282"
indices Array of Int

An array of integers representing the offsets within the Tweet text where the user reference begins and ends. The first integer represents the location of the ‘@’ character of the user mention. The second integer represents the location of the first non-screenname character following the user mention. Example:

"indices":[4,15]
name String

Display name of the referenced user. Example:

"name":"Twitter API"
screen_name String

Screen name of the referenced user. Example:

"screen_name":"twitterapi"