> ## 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.

# List Members Lookup

> X API v2 List members lookup 엔드포인트로 X List의 멤버를 조회하는 퀵스타트로, 인증 및 요청 예시를 포함합니다.

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

이 가이드는 List의 멤버를 조회하는 방법을 안내합니다.

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

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

  * 승인된 App이 포함된 [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * App의 Bearer Token
</Note>

***

## List 멤버 가져오기

<Steps>
  <Step title="List ID 찾기">
    List를 볼 때 URL에서 List ID를 찾을 수 있습니다:

    ```
    https://x.com/i/lists/84839422
                          └── 이 부분이 List ID
    ```
  </Step>

  <Step title="List 멤버 요청">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl "https://api.x.com/2/lists/84839422/members?\
      user.fields=created_at,username,verified&\
      max_results=100" \
        -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")

      # 페이지네이션으로 List 멤버 가져오기
      for page in client.lists.get_members(
          "84839422",
          user_fields=["created_at", "username", "verified"],
          max_results=100
      ):
          for user in page.data:
              print(f"{user.username} - Joined: {user.created_at}")
      ```

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

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

      // 페이지네이션으로 List 멤버 가져오기
      const paginator = client.lists.getMembers("84839422", {
        userFields: ["created_at", "username", "verified"],
        maxResults: 100,
      });

      for await (const page of paginator) {
        page.data?.forEach((user) => {
          console.log(`${user.username} - Joined: ${user.created_at}`);
        });
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="응답 확인">
    ```json theme={null}
    {
      "data": [
        {
          "id": "1319036828964454402",
          "name": "Birdwatch",
          "username": "birdwatch",
          "created_at": "2020-10-21T22:04:47.000Z",
          "verified": true
        },
        {
          "id": "1065249714214457345",
          "name": "Spaces",
          "username": "TwitterSpaces",
          "created_at": "2018-11-21T14:24:58.000Z",
          "verified": true
        }
      ],
      "meta": {
        "result_count": 2,
        "next_token": "5349804505549807616"
      }
    }
    ```
  </Step>
</Steps>

***

## 추가 데이터 포함하기

고정된 Post와 같은 관련 데이터를 가져오려면 expansion을 사용하세요:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/lists/84839422/members?\
  user.fields=created_at&\
  expansions=pinned_tweet_id&\
  tweet.fields=created_at" \
    -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")

  # expansion과 함께 List 멤버 가져오기
  for page in client.lists.get_members(
      "84839422",
      user_fields=["created_at"],
      expansions=["pinned_tweet_id"],
      tweet_fields=["created_at"]
  ):
      for user in page.data:
          print(f"{user.username}")
      # 고정된 Post는 page.includes.tweets에 있음
  ```

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

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

  // expansion과 함께 List 멤버 가져오기
  const paginator = client.lists.getMembers("84839422", {
    userFields: ["created_at"],
    expansions: ["pinned_tweet_id"],
    tweetFields: ["created_at"],
  });

  for await (const page of paginator) {
    page.data?.forEach((user) => {
      console.log(user.username);
    });
    // 고정된 Post는 page.includes?.tweets에 있음
  }
  ```
</CodeGroup>

***

## 다음 단계

<CardGroup cols={2}>
  <Card title="List 멤버 관리" icon="user-plus" href="/x-api/lists/list-members/quickstart/manage-list-members">
    멤버 추가 및 제거
  </Card>

  <Card title="List lookup" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-bulleted-list.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=b9bf8323233df59c682b0fec8e3f88d5" href="/x-api/lists/list-lookup/quickstart" width="24" height="24" data-path="icons/xds/icon-bulleted-list.svg">
    List 세부 정보 가져오기
  </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/lists/get-list-members" width="24" height="24" data-path="icons/xds/icon-code.svg">
    전체 엔드포인트 문서
  </Card>
</CardGroup>
