영어 API 플레이그라운드 열기 (영어로 제공되는 페이지)

사용자 이름으로 조회

GET/tw-v2/user/by-username

설명

플랫폼 사용자 이름으로 상세한 사용자 프로필 정보를 조회합니다. 통계, 인증 상태, 프로필 메타데이터를 포함한 사용자 데이터를 반환합니다.

매개변수

매개변수유형필수 여부설명
usernamestring필수@ 기호를 제외한 플랫폼 사용자 이름(예: 'sample_user_96991')

코드 예제

const params = new URLSearchParams({
  username: 'sample_user_96991'
});

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);

응답

성공 응답(200 OK)

200
{
  "data": {
    "id": "10017528",
    "username": "sample_user_96991",
    "name": "Sample User 96991",
    "bio": "Sample profile bio for Sample User 96991.",
    "location": null,
    "website": null,
    "pinnedTweetIds": [
      "2001738170940982678"
    ],
    "avatar": "https://example.com/images/sample-avatar-96991.jpg",
    "banner": "https://example.com/images/sample-banner-96991.jpg",
    "profileImageShape": "Circle",
    "verified": false,
    "isBlueVerified": true,
    "verifiedType": null,
    "verifiedSince": null,
    "isIdentityVerified": false,
    "isProtected": false,
    "possiblySensitive": false,
    "profileInterstitialType": null,
    "withheldInCountries": [],
    "professional": {
      "type": "Creator",
      "category": [],
      "restId": "9001630152611040706"
    },
    "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://example.com/link-94089/profile-41921/X",
          "urlType": "DeepLink"
        },
        "badge": {
          "url": "https://example.com/link-94089/profile-29900/media/sample-media-25883.jpg"
        },
        "description": "Sample description for documentation 53418.",
        "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"
  }
}