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

# Pinned Lists Lookup

> X API v2 の pinned Lists 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)
  * ユーザー Access Token (OAuth 1.0a または OAuth 2.0 PKCE)
</Note>

***

## ピン留めした List を取得

<Steps>
  <Step title="user ID を取得">
    認証済みユーザーの ID が必要です。[user lookup エンドポイント](/x-api/users/lookup/introduction)を使って取得するか、Access Token から確認できます (数値部分が user ID)。
  </Step>

  <Step title="ピン留めした List をリクエスト">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl "https://api.x.com/2/users/2244994945/pinned_lists?\
      list.fields=follower_count,member_count,owner_id&\
      expansions=owner_id&\
      user.fields=created_at,username" \
        -H "Authorization: Bearer $USER_ACCESS_TOKEN"
      ```

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

      client = Client(bearer_token="YOUR_USER_ACCESS_TOKEN")

      # ピン留めした List を取得
      response = client.lists.get_pinned(
          "2244994945",
          list_fields=["follower_count", "member_count", "owner_id"],
          expansions=["owner_id"],
          user_fields=["created_at", "username"]
      )

      for lst in response.data:
          print(f"{lst.name} - {lst.follower_count} followers")
      ```

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

      const client = new Client({ accessToken: "YOUR_USER_ACCESS_TOKEN" });

      // ピン留めした List を取得
      const response = await client.lists.getPinned("2244994945", {
        listFields: ["follower_count", "member_count", "owner_id"],
        expansions: ["owner_id"],
        userFields: ["created_at", "username"],
      });

      response.data?.forEach((lst) => {
        console.log(`${lst.name} - ${lst.follower_count} followers`);
      });
      ```
    </CodeGroup>
  </Step>

  <Step title="レスポンスを確認">
    ```json theme={null}
    {
      "data": [
        {
          "id": "1454155907651158017",
          "name": "Tech News",
          "follower_count": 150,
          "member_count": 25,
          "owner_id": "2244994945"
        }
      ],
      "includes": {
        "users": [
          {
            "id": "2244994945",
            "username": "XDevelopers",
            "name": "X Developers",
            "created_at": "2013-12-14T04:35:55.000Z"
          }
        ]
      },
      "meta": {
        "result_count": 1
      }
    }
    ```
  </Step>
</Steps>

***

## 利用可能な List フィールド

| Field            | Description   |
| :--------------- | :------------ |
| `description`    | List の説明      |
| `owner_id`       | 所有者の user ID  |
| `private`        | List が非公開かどうか |
| `member_count`   | メンバー数         |
| `follower_count` | フォロワー数        |
| `created_at`     | List の作成日     |

***

## 次のステップ

<CardGroup cols={2}>
  <Card title="Manage pinned Lists" icon="thumbtack" href="/x-api/lists/pinned-lists/quickstart/manage-pinned-lists">
    List のピン留め・解除
  </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/users/get-pinned-lists" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの詳細ドキュメント
  </Card>
</CardGroup>
