메인 콘텐츠로 건너뛰기
이 가이드는 ID 또는 사용자 이름으로 사용자를 조회하는 방법을 단계별로 안내합니다.
사전 준비 사항시작하기 전에 다음이 필요합니다.

ID로 조회

단일 사용자

cURL
curl "https://api.x.com/2/users/2244994945?\
user.fields=created_at,description,verified,public_metrics" \
  -H "Authorization: Bearer $BEARER_TOKEN"

응답

{
  "data": {
    "id": "2244994945",
    "name": "X Developers",
    "username": "XDevelopers",
    "created_at": "2013-12-14T04:35:55.000Z",
    "description": "The voice of the X developer community",
    "verified": true,
    "public_metrics": {
      "followers_count": 583423,
      "following_count": 2048,
      "tweet_count": 14052,
      "listed_count": 1672
    }
  }
}

여러 사용자

한 번에 최대 100명의 사용자를 조회할 수 있습니다:
cURL
curl "https://api.x.com/2/users?\
ids=2244994945,783214,6253282&\
user.fields=username,verified" \
  -H "Authorization: Bearer $BEARER_TOKEN"

사용자 이름으로 조회

단일 사용자

cURL
curl "https://api.x.com/2/users/by/username/XDevelopers?\
user.fields=created_at,description,verified" \
  -H "Authorization: Bearer $BEARER_TOKEN"

여러 사용자

cURL
curl "https://api.x.com/2/users/by?\
usernames=XDevelopers,X,elonmusk&\
user.fields=created_at,verified" \
  -H "Authorization: Bearer $BEARER_TOKEN"

사용 가능한 필드

FieldDescription
created_at계정 생성 일시
description사용자 소개
profile_image_url프로필 이미지 URL
verified인증 상태
public_metrics팔로워/팔로잉 수
location사용자가 지정한 위치
url사용자의 웹사이트
protected비공개 계정 여부
pinned_tweet_id고정된 게시물 ID

errors 처리하기

사용자를 찾을 수 없습니다

{
  "errors": [
    {
      "resource_type": "user",
      "title": "Not Found Error",
      "detail": "Could not find user with username: [nonexistent_user]."
    }
  ]
}

보호된 사용자

보호된 사용자의 데이터는 여전히 반환되지만, 해당 사용자를 팔로우하지 않으면 해당 사용자의 포스트에는 접근할 수 없습니다.

다음 단계

인증된 사용자

현재 사용자 가져오기

통합 가이드

핵심 개념과 모범 사례

API 참조 문서

전체 엔드포인트 문서