By Username
GET
/tw-v2/user/by-usernameDescription
Retrieve comprehensive user profile information using a Twitter/X username. Returns detailed user data including statistics, verification status, and profile metadata.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| username | string | required | Twitter/X username without @ symbol (e.g., 'elonmusk') |
Code Examples
const params = new URLSearchParams({
username: 'elonmusk'
});
const response = await fetch(`https://api.tweetapi.com/tw-v2/user/by-username?${params}`, {
method: 'GET',
headers: {
'X-API-Key': 'YOUR_API_KEY'
}
});
const data = await response.json();
console.log(data);
Response
Success Response (200 OK)
200
{
"data": {
"id": "44196397",
"username": "elonmusk",
"name": "Elon Musk",
"bio": "https://t.co/9qhgzJ69UQ",
"location": null,
"website": null,
"pinnedTweetIds": [
"1973288477988143277"
],
"avatar": "https://pbs.twimg.com/profile_images/1936002956333080576/kqqe2iWO_400x400.jpg",
"banner": "https://pbs.twimg.com/profile_banners/44196397/1739948056/1500x500",
"profileImageShape": "Circle",
"verified": false,
"isBlueVerified": true,
"verifiedType": null,
"verifiedSince": null,
"isIdentityVerified": false,
"isProtected": false,
"possiblySensitive": false,
"profileInterstitialType": null,
"withheldInCountries": [],
"professional": {
"type": "Creator",
"category": [],
"restId": "1679729435447275522"
},
"businessAccount": {
"affiliatesCount": 0
},
"creatorSubscriptionsCount": 225,
"hasHiddenSubscriptions": true,
"highlightsInfo": {
"canHighlight": true,
"highlightedTweetsCount": "758"
},
"hasGraduatedAccess": true,
"isProfileTranslatable": false,
"hasCustomTimelines": true,
"isTranslator": false,
"affiliatesHighlightedLabel": {
"label": {
"url": {
"url": "https://twitter.com/X",
"urlType": "DeepLink"
},
"badge": {
"url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg"
},
"description": "X",
"userLabelType": "BusinessLabel",
"userLabelDisplayType": "Badge"
}
},
"defaultProfile": false,
"defaultProfileImage": false,
"followerCount": 226995885,
"followingCount": 1218,
"tweetCount": 86745,
"listedCount": 164447,
"mediaCount": 4162,
"favoritesCount": 174837,
"createdAt": "2009-06-02T20:12:29.000Z"
}
}API Playground
GET
/tw-v2/user/by-usernamePress ⌘ + Enter to execute
curl -X GET "https://api.tweetapi.com/tw-v2/user/by-username" \
-H "X-API-Key: YOUR_API_KEY"Response
Click "Try It!" to see the response