Get Profile by Username

GET

Get Twitter profile information by username

GET /api/v1/twitter/users/profile_by_username/:username

Authorization

X-API-Key
string
required

Parameters

NameTypeRequiredDescription
usernamestring
required
The Twitter username

Example Request

curl -X GET \
"https://api.xscraper.xyz/api/v1/twitter/users/profile_by_username/elonmusk" \
-H "X-API-Key: "

Response

User Profile
application/json
{
  "data": {
    "avatar": "https://pbs.twimg.com/profile_images/1683325380441128960/yRsRRjGO_400x400.jpg",
    "banner": "https://pbs.twimg.com/profile_banners/44196397/1576183471/1500x500",
    "biography": "Nothing",
    "birthday": null,
    "followersCount": 181293000,
    "followingCount": 150,
    "friendsCount": 150,
    "mediaCount": 3950,
    "statusesCount": 35000,
    "isPrivate": false,
    "isVerified": true,
    "isBlueVerified": true,
    "joined": "2009-06-02T20:12:29.000Z",
    "likesCount": 21300,
    "listedCount": 150000,
    "location": "Mars",
    "name": "Elon Musk",
    "pinnedTweetIds": ["1722715025402413077"],
    "tweetsCount": 35000,
    "url": "https://twitter.com/elonmusk",
    "userId": "44196397",
    "username": "elonmusk",
    "website": "https://x.com",
    "canDm": false
  },
  "meta": {
    "statusCode": 200,
    "timestamp": "2025-04-19T15:49:28.824Z"
  }
}

Error Responses

401 Unauthorized
{
  "statusCode": 401,
  "timestamp": "2025-04-19T15:49:28.824Z",
  "path": "/api/v1/twitter/users/profile_by_username/elonmusk",
  "method": "GET",
  "message": "Invalid or expired API key"
}
404 Not Found
{
  "statusCode": 404,
  "timestamp": "2025-04-19T15:49:28.824Z",
  "path": "/api/v1/twitter/users/profile_by_username/nonexistentuser",
  "method": "GET",
  "message": "Profile not found"
}