> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# User Mentions 타임라인

> 이 가이드에서는 특정 사용자를 멘션한 게시물을 조회하는 방법을 안내합니다. 퀵스타트를 다루는 X API v2 standard 티어 레퍼런스입니다.

export const Button = ({href, children}) => {
  return <div className="not-prose">
    <a href={href}>
      <button className="x-btn">
        <span>{children}</span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

이 가이드에서는 특정 사용자를 멘션한 게시물을 조회하는 방법을 안내합니다.

<Note>
  **사전 요구사항**

  시작하기 전에 다음이 필요합니다:

  * 승인된 App이 있는 [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * App의 Bearer Token(공개 데이터용) 또는 User Access Token(비공개 지표용)
</Note>

***

## User mentions 가져오기

<Steps>
  <Step title="user ID 확인">
    [user lookup 엔드포인트](/x-api/users/lookup/introduction)를 사용해 user ID를 확인합니다. 예를 들어 @XDevelopers의 user ID는 `2244994945`입니다.
  </Step>

  <Step title="mentions 타임라인 요청">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      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"
      ```

      ```python title="Python SDK" lines wrap icon="python" theme={null}
      from xdk import Client

      client = Client(bearer_token="YOUR_BEARER_TOKEN")

      # Get mentions timeline with pagination
      for page in client.posts.get_user_mentions(
          "2244994945",
          tweet_fields=["created_at", "public_metrics", "author_id"],
          expansions=["author_id"],
          user_fields=["username", "verified"],
          max_results=10
      ):
          for post in page.data:
              print(f"@{post.author_id}: {post.text[:50]}...")
      ```

      ```javascript title="JavaScript SDK" lines wrap icon="square-js" theme={null}
      import { Client } from "@xdevplatform/xdk";

      const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

      // Get mentions timeline with pagination
      const paginator = client.posts.getUserMentions("2244994945", {
        tweetFields: ["created_at", "public_metrics", "author_id"],
        expansions: ["author_id"],
        userFields: ["username", "verified"],
        maxResults: 10,
      });

      for await (const page of paginator) {
        page.data?.forEach((post) => {
          console.log(`@${post.author_id}: ${post.text?.slice(0, 50)}...`);
        });
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="응답 확인">
    ```json theme={null}
    {
      "data": [
        {
          "id": "1301573587187331074",
          "text": "Hey @XDevelopers, love the new 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"
      }
    }
    ```
  </Step>
</Steps>

***

## 멘션 필터링

### 답글 제외

사용자를 멘션한 원본 게시물만 가져오기:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/users/2244994945/mentions?\
  exclude=replies&\
  max_results=10" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python title="Python SDK" lines wrap icon="python" theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # Get mentions excluding replies
  for page in client.posts.get_user_mentions(
      "2244994945",
      exclude=["replies"],
      max_results=10
  ):
      for post in page.data:
          print(post.text)
  ```

  ```javascript title="JavaScript SDK" lines wrap icon="square-js" theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // Get mentions excluding replies
  const paginator = client.posts.getUserMentions("2244994945", {
    exclude: ["replies"],
    maxResults: 10,
  });

  for await (const page of paginator) {
    page.data?.forEach((post) => {
      console.log(post.text);
    });
  }
  ```
</CodeGroup>

### 시간 범위 내 멘션 가져오기

<CodeGroup dropdown>
  ```bash cURL theme={null}
  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"
  ```

  ```python title="Python SDK" lines wrap icon="python" theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # Get mentions in a time range
  for page in client.posts.get_user_mentions(
      "2244994945",
      start_time="2024-01-01T00:00:00Z",
      end_time="2024-01-31T23:59:59Z"
  ):
      for post in page.data:
          print(f"{post.created_at}: {post.text[:50]}...")
  ```

  ```javascript title="JavaScript SDK" lines wrap icon="square-js" theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // Get mentions in a time range
  const paginator = client.posts.getUserMentions("2244994945", {
    startTime: "2024-01-01T00:00:00Z",
    endTime: "2024-01-31T23:59:59Z",
  });

  for await (const page of paginator) {
    page.data?.forEach((post) => {
      console.log(`${post.created_at}: ${post.text?.slice(0, 50)}...`);
    });
  }
  ```
</CodeGroup>

***

## 공통 파라미터

| Parameter          | Description                     | Default |
| :----------------- | :------------------------------ | :------ |
| `max_results`      | 페이지당 결과 수 (1-100)               | 10      |
| `start_time`       | 가장 오래된 게시물 타임스탬프 (ISO 8601)     | —       |
| `end_time`         | 가장 최근 게시물 타임스탬프 (ISO 8601)      | —       |
| `since_id`         | 이 ID 이후의 게시물 반환                 | —       |
| `until_id`         | 이 ID 이전의 게시물 반환                 | —       |
| `exclude`          | `retweets`, `replies` 또는 둘 다 제외 | —       |
| `pagination_token` | 다음 페이지 토큰                       | —       |

***

## 다음 단계

<CardGroup cols={2}>
  <Card title="Home timeline" icon="house" href="/x-api/posts/timelines/quickstart/reverse-chron-quickstart">
    사용자의 홈 타임라인 가져오기
  </Card>

  <Card title="통합 가이드" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-book.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=22ac564792481d14ae36a941546039c8" href="/x-api/posts/timelines/integrate" width="24" height="24" data-path="icons/xds/icon-book.svg">
    핵심 개념 및 모범 사례
  </Card>

  <Card title="API 레퍼런스" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-code.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=488e23401b19225b89acc0136d242219" href="/x-api/users/get-mentions" width="24" height="24" data-path="icons/xds/icon-code.svg">
    전체 엔드포인트 문서
  </Card>

  <Card title="페이지네이션 가이드" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-arrow-right.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=88e933002782dbdeb204043cedef033e" href="/x-api/fundamentals/pagination" width="24" height="24" data-path="icons/xds/icon-arrow-right.svg">
    큰 결과 집합 탐색
  </Card>
</CardGroup>
