RequestBeam Docs
Get User By Username
Query a Twitter user profile by username and return a normalized X API v2-style user object.
https://api.requestbeam.com/v1/twitter/usersUse username to query a user profile. This endpoint is useful when you only know a username and need the normalized data.id for timeline requests.
GET https://api.requestbeam.com/v1/twitter/usersAuthentication
All Twitter API endpoints require Bearer Token authentication.
Authorization: Bearer YOUR_API_KEYQuery Parameters
usernamestringrequiredTwitter username. Both elonmusk and @elonmusk are accepted; the leading @ is removed server-side.
user.fieldsstringComma-separated user fields, such as created_at,description,public_metrics,verified.
Request Example
curl --request GET \
"$API_BASE_URL/v1/twitter/users?username=elonmusk&user.fields=created_at,description,public_metrics,verified" \
--header "Authorization: Bearer YOUR_API_KEY"Response
dataobjectrequiredNormalized user object.
data fields
idstringrequiredUnique user identifier. Prefer this value for timeline queries.
namestringrequiredDisplay name.
usernamestringrequiredUsername without @.
created_atstringISO 8601 timestamp, returned when user.fields=created_at is requested.
descriptionstringUser bio.
entitiesobjectProfile entities, such as URL descriptions and links.
locationstringLocation in the user profile.
pinned_tweet_idstringID of the pinned tweet.
profile_banner_urlstringProfile banner URL.
profile_image_urlstringProfile image URL.
protectedbooleanWhether the account is protected.
public_metricsobjectPublic user metrics.
public_metrics fields
followers_countintegerNumber of followers.
following_countintegerNumber of accounts followed.
tweet_countintegerTotal number of tweets.
listed_countintegerNumber of lists containing the user. May be absent when the data source does not provide it.
urlstringWebsite URL in the user profile.
verifiedbooleanWhether the account is verified.
verified_typestringVerification type, such as Business.
Success Example
{
"data": {
"id": "44196397",
"name": "Elon Musk",
"username": "elonmusk",
"created_at": "2009-06-02T20:12:29.000Z",
"description": "Mars and cars",
"public_metrics": {
"followers_count": 10,
"following_count": 20,
"tweet_count": 40
},
"verified": true
}
}Error Response
See Error Codes and Troubleshooting for the full code reference, protocol differences, and diagnostic steps.
{
"success": false,
"error": {
"code": 40000,
"message": "Insufficient credit. Required: 100000, Available: 99999"
},
"requestId": "req_xxx"
}Usage Tips
- If you only know
username, call this endpoint first - If you plan to query a timeline, use the returned
data.id - If you only need avatar, bio, or follower counts, pass
user.fieldsexplicitly