메인 콘텐츠로 건너뛰기
이 가이드는 특정 사용자를 언급한 포스트를 가져오는 방법을 단계별로 안내합니다.
사전 준비 사항시작하기 전에 다음이 필요합니다:
  • 승인된 App이 있는 개발자 계정
  • App의 Bearer 토큰(공개 데이터용) 또는 사용자 액세스 토큰(비공개 지표용)

사용자 멘션 가져오기

1

사용자 ID 가져오기

user lookup endpoint를 사용하여 사용자 ID를 찾습니다. 예를 들어, @XDevelopers의 사용자 ID는 2244994945입니다.
2

멘션 타임라인 요청하기

cURL
curl "https://api.x.com/2/users/2244994945/mentions?\
tweet.fields=created_at,public_metrics,author_id&\
expansions=author_id&\
user.fields=username,verified&\
max_results=10" \
  -H "Authorization: Bearer $BEARER_TOKEN"
3

응답 확인하기

{
  "data": [
    {
      "id": "1301573587187331074",
      "text": "Hey @XDevelopers, 새로운 API 정말 마음에 들어요!",
      "author_id": "1234567890",
      "created_at": "2024-01-15T10:30:00.000Z",
      "public_metrics": {
        "retweet_count": 5,
        "reply_count": 2,
        "like_count": 42,
        "quote_count": 1
      }
    }
  ],
  "includes": {
    "users": [
      {
        "id": "1234567890",
        "username": "developer",
        "name": "Dev Person",
        "verified": false
      }
    ]
  },
  "meta": {
    "newest_id": "1301573587187331074",
    "oldest_id": "1301573587187331074",
    "result_count": 1,
    "next_token": "t3buvdr5pujq9g7bggsnf3ep2ha28"
  }
}

멘션 필터링

답글 제외

사용자를 멘션한 원본 포스트만 가져오려면:
cURL
curl "https://api.x.com/2/users/2244994945/mentions?\
exclude=replies&\
max_results=10" \
  -H "Authorization: Bearer $BEARER_TOKEN"

시간 범위 내 멘션 가져오기

cURL
curl "https://api.x.com/2/users/2244994945/mentions?\
start_time=2024-01-01T00%3A00%3A00Z&\
end_time=2024-01-31T23%3A59%3A59Z" \
  -H "Authorization: Bearer $BEARER_TOKEN"

공통 매개변수

매개변수설명기본값
max_results페이지당 결과 수 (1-100)10
start_time가장 오래된 게시물의 타임스탬프 (ISO 8601)
end_time가장 최신 게시물의 타임스탬프 (ISO 8601)
since_id이 id 이후의 포스트를 반환
until_id이 id 이전의 포스트를 반환
excluderetweets, replies 또는 둘 다를 제외
pagination_token다음 페이지에 대한 토큰

다음 단계

홈 타임라인

사용자의 홈 타임라인 가져오기

통합 가이드

핵심 개념과 모범 사례 알아보기

API 참조 문서

전체 엔드포인트 문서 보기

페이지네이션 가이드

대용량 결과 집합 탐색하기