Users by Username
GET https://api.twitter.com/2/users/by?usernames=
This endpoint returns details about up to 100 users specified by username.
For full details, see the API reference for this endpoint.
Sign up for the Twitter API
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
usernames | null | Required. Enter up to 100 comma-separated usernames. | |
user.fields | null | Comma-separated fields for the user object. |
Allowed values: created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld
Default values:
id,name,username |
| expansions
| null | | Expansions enable requests to expand an ID into a full object in the includes response object.
Allowed value: pinned_tweet_id
Default value: none |
| tweet.fields
| null | | Comma-separated list of fields for the Tweet object. Expansion required.
Allowed values: attachments,author_id,context_annotations,conversation_id,created_at,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld
Default values: id,text
OAuth1.0a User Context authorization required if any of the following fields are included in the request: non_public_metrics,organic_metrics,promoted_metrics |
RESPONSES
status: OK
{"data":[{"id":"495309159","name":"Twitter New York City","username":"TwitterNYC"},{"id":"172020392","name":"Twitter San Francisco","username":"TwitterSF"},{"id":"95731075","name":"Twitter Safety","username":"TwitterSafety"},{"id":"2548985366","name":"Twitter Blackbirds","username":"Blackbirds"},{"id":"277761722","name":"Twitter UK","username":"TwitterUK"},{"id":"17874544","name":"Twitter Support","username":"TwitterSupport"},{"id":"300392950","name":"Twitter Sports","username":"TwitterSports"},{"id":"87532773","name":"Twitter Design","username":"TwitterDesign"}],"errors":[{"detail":"Could not find user with usernames: [twitterrrrrrr].","title":"Not Found Error","resource_type":"user","parameter":"usernames","value":"twitterrrrrrr","type":"https://api.twitter.com/2/problems/resource-not-found"},{"detail":"Could not find user with usernames: [twitterdevvvvvv].","title":"Not Found Error","resource_type":"user","parameter":"usernames","value":"twitterdevvvvvv","type":"https://api.twitter.com/2/problems/resource-not-found"},{"detail":"Could not find user with usernames: [twitterapiiiii].","title":"Not Found Error","resource_type":"user","parameter":"usernames","value":"twitterapiiiii","type":"https://api.twitter.com/2/problems/resource-not-found"}]}