User object
The User object contains Twitter User account metadata that describes the Twitter User referenced. Users can author Tweets, Retweet, quote other Users Tweets, reply to Tweets, follow Users, be @mentioned in Tweets and can be grouped into lists.
The Tweet object will also contain User objects of the Users involved within a Tweet. In case of Retweets and Quoted Tweets, the top-level user
object represents what account took that action, and the JSON payload will include a second user
within the retweeted_status
for the account that created the original Tweet. User objects can be retireved using the id
or screen_name
.
In general these user
metadata values are relatively constant. Some fields never change, such as the user's id
(provided as a string id_str
) and when the account was created. Other metadata can occasionally change, such as the screen_name
, displayname
, description
, location
, and other profile details. Some metadata frequently changes, such as the number of Tweets the account has posted statuses_count
and its number of followers followers_count
.
User Data Dictionary
Attribute | Type | Description |
---|---|---|
id | Int64 | The integer representation of the unique identifier for this User. This number is greater than 53 bits and some programming languages may have difficulty/silent defects in interpreting it. Using a signed 64 bit integer for storing this identifier is safe. Use
"id": 6253282
|
id_str | String | The string representation of the unique identifier for this User. Implementations should use this rather than the large, possibly un-consumable integer in
"id_str": "6253282"
|
name | String | The name of the user, as they’ve defined it. Not necessarily a person’s name. Typically capped at 50 characters, but subject to change. Example:
"name": "Twitter API"
|
screen_name | String | The screen name, handle, or alias that this user identifies themselves with. screen_names are unique but subject to change. Use
"screen_name": "twitterapi"
|
location | String | Nullable . The user-defined location for this account’s profile. Not necessarily a location, nor machine-parseable. This field will occasionally be fuzzily interpreted by the Search service. Example:
"location": "San Francisco, CA"
|
derived | Arrays of Enrichment Objects | Enterprise APIs only Collection of Enrichment metadata derived for user. Provides the Profile Geo Enrichment metadata. See referenced documentation for more information, including JSON data dictionaries. Example:
"derived":{"locations": [{"country":"United States","country_code":"US","locality":"Denver"}]}
|
url | String | Nullable . A URL provided by the user in association with their profile. Example:
"url": "https://developer.twitter.com"
|
description | String | Nullable . The user-defined UTF-8 string describing their account. Example:
"description": "The Real Twitter API."
|
protected | Boolean | When true, indicates that this user has chosen to protect their Tweets. See About Public and Protected Tweets . Example:
"protected": true
|
verified | Boolean | When true, indicates that the user has a verified account. See Verified Accounts . Example:
"verified": false
|
followers_count | Int | The number of followers this account currently has. Under certain conditions of duress, this field will temporarily indicate “0”. Example:
"followers_count": 21
|
friends_count | Int | The number of users this account is following (AKA their “followings”). Under certain conditions of duress, this field will temporarily indicate “0”. Example:
"friends_count": 32
|
listed_count | Int | The number of public lists that this user is a member of. Example:
"listed_count": 9274
|
favourites_count | Int | The number of Tweets this user has liked in the account’s lifetime. British spelling used in the field name for historical reasons. Example:
"favourites_count": 13
|
statuses_count | Int | The number of Tweets (including retweets) issued by the user. Example:
"statuses_count": 42
|
created_at | String | The UTC datetime that the user account was created on Twitter. Example:
"created_at": "Mon Nov 29 21:18:15 +0000 2010"
|
profile_banner_url | String | The HTTPS-based URL pointing to the standard web representation of the user’s uploaded profile banner. By adding a final path element of the URL, it is possible to obtain different image sizes optimized for specific displays. For size variants, please see User Profile Images and Banners . Example:
"profile_banner_url": "https://si0.twimg.com/profile_banners/819797/1348102824"
|
profile_image_url_https | String | A HTTPS-based URL pointing to the user’s profile image. Example:
"profile_image_url_https":
"https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png"
|
default_profile | Boolean | When true, indicates that the user has not altered the theme or background of their user profile. Example:
"default_profile": false
|
default_profile_image | Boolean | When true, indicates that the user has not uploaded their own profile image and a default image is used instead. Example:
"default_profile_image": false
|
withheld_in_countries | Array of String | When present, indicates a list of uppercase two-letter country codes this content is withheld from. Twitter supports the following non-country values for this field: “XX” - Content is withheld in all countries “XY” - Content is withheld due to a DMCA request. Example:
"withheld_in_countries": ["GR", "HK", "MY"]
|
withheld_scope | String | When present, indicates that the content being withheld is a “user.” Example:
"withheld_scope": "user"
|
No longer supported (deprecated) attributes
Field | Type | Description |
---|---|---|
utc_offset | null | Value will be set to null. Still available via GET account/settings |
time_zone | null | Value will be set to null. Still available via GET account/settings as tzinfo_name |
lang | null | Value will be set to null. Still available via GET account/settings as language |
geo_enabled | null | Value will be set to null. Still available via GET account/settings. This field must be true for the current user to attach geographic data when using POST statuses / update |
following | null | Value will be set to null. Still available via GET friendships/lookup |
follow_request_sent | null | Value will be set to null. Still available via GET friendships/lookup |
has_extended_profile | null | Deprecated. Value will be set to null. |
notifications | null | Deprecated. Value will be set to null. |
profile_location | null | Deprecated. Value will be set to null. |
contributors_enabled | null | Deprecated. Value will be set to null. |
profile_image_url | null | Deprecated. Value will be set to null. NOTE: Profile images are only available using the profile_image_url_https field. |
profile_background_color | null | Deprecated. Value will be set to null. |
profile_background_image_url | null | Deprecated. Value will be set to null. |
profile_background_image_url_https | null | Deprecated. Value will be set to null. |
profile_background_tile | null | Deprecated. Value will be set to null. |
profile_link_color | null | Deprecated. Value will be set to null. |
profile_sidebar_border_color | null | Deprecated. Value will be set to null. |
profile_sidebar_fill_color | null | Deprecated. Value will be set to null. |
profile_text_color | null | Deprecated. Value will be set to null. |
profile_use_background_image | null | Deprecated. Value will be set to null. |
is_translator | null | Deprecated. Value will be set to null. |
is_translation_enabled | null | Deprecated. Value will be set to null. |
translator_type | null | Deprecated. Value will be set to null. |
Example user object:
{
"id": 6253282,
"id_str": "6253282",
"name": "Twitter API",
"screen_name": "TwitterAPI",
"location": "San Francisco, CA",
"profile_location": null,
"description": "The Real Twitter API. Tweets about API changes, service issues and our Developer Platform. Don't get an answer? It's on my website.",
"url": "https:\/\/t.co\/8IkCzCDr19",
"entities": {
"url": {
"urls": [{
"url": "https:\/\/t.co\/8IkCzCDr19",
"expanded_url": "https:\/\/developer.twitter.com",
"display_url": "developer.twitter.com",
"indices": [
0,
23
]
}]
},
"description": {
"urls": []
}
},
"protected": false,
"followers_count": 6133636,
"friends_count": 12,
"listed_count": 12936,
"created_at": "Wed May 23 06:01:13 +0000 2007",
"favourites_count": 31,
"utc_offset": null,
"time_zone": null,
"geo_enabled": null,
"verified": true,
"statuses_count": 3656,
"lang": null,
"contributors_enabled": null,
"is_translator": null,
"is_translation_enabled": null,
"profile_background_color": null,
"profile_background_image_url": null,
"profile_background_image_url_https": null,
"profile_background_tile": null,
"profile_image_url": null,
"profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/942858479592554497\/BbazLO9L_normal.jpg",
"profile_banner_url": null,
"profile_link_color": null,
"profile_sidebar_border_color": null,
"profile_sidebar_fill_color": null,
"profile_text_color": null,
"profile_use_background_image": null,
"has_extended_profile": null,
"default_profile": false,
"default_profile_image": false,
"following": null,
"follow_request_sent": null,
"notifications": null,
"translator_type": null
}
Next Steps
Explore the other sub-objects that a Tweet contains: