> ## 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 のタイムラインから Post を取得する手順を説明します。X API v2 スタンダード階層の list tweets に関するリファレンスドキュメントです。

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 のタイムラインから Post を取得する手順を説明します。

<Note>
  **前提条件**

  始める前に、以下が必要です:

  * 承認済みの App がある [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * App の Bearer Token
</Note>

***

<Steps>
  <Step title="List ID を確認" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-bulleted-list.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=b9bf8323233df59c682b0fec8e3f88d5" width="24" height="24" data-path="icons/xds/icon-bulleted-list.svg">
    x.com で List を表示中の URL から List ID を確認できます:

    ```
    https://x.com/i/lists/84839422
                          └── これが List ID
    ```
  </Step>

  <Step title="List タイムラインをリクエスト" icon="terminal">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl "https://api.x.com/2/lists/84839422/tweets?\
      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")

      # ページネーションで List から Post を取得
      for page in client.lists.get_tweets(
          "84839422",
          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.text[:50]}... - Likes: {post.public_metrics.like_count}")
      ```

      ```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 から Post を取得
      const paginator = client.lists.getTweets("84839422", {
        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.text?.slice(0, 50)}... - Likes: ${post.public_metrics?.like_count}`);
        });
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="レスポンスを確認" icon="eye">
    ```json theme={null}
    {
      "data": [
        {
          "id": "1458172421115101189",
          "text": "Check out our latest announcement...",
          "author_id": "4172587277",
          "created_at": "2024-01-15T10:30:00.000Z",
          "public_metrics": {
            "retweet_count": 42,
            "reply_count": 5,
            "like_count": 156,
            "quote_count": 3
          },
          "edit_history_tweet_ids": ["1458172421115101189"]
        }
      ],
      "includes": {
        "users": [
          {
            "id": "4172587277",
            "username": "TechNews",
            "verified": true
          }
        ]
      },
      "meta": {
        "result_count": 1,
        "next_token": "7140dibdnow9c7btw3z2vwioavpvutgzrzm9icis4ndix"
      }
    }
    ```
  </Step>

  <Step title="結果をページネーション" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-arrow-right.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=88e933002782dbdeb204043cedef033e" width="24" height="24" data-path="icons/xds/icon-arrow-right.svg">
    SDK は自動でページネーションを処理します。cURL の場合は、レスポンスの `next_token` を使ってさらに Post を取得します:

    ```bash theme={null}
    curl "https://api.x.com/2/lists/84839422/tweets?\
    max_results=10&\
    pagination_token=7140dibdnow9c7btw3z2vwioavpvutgzrzm9icis4ndix" \
      -H "Authorization: Bearer $BEARER_TOKEN"
    ```
  </Step>
</Steps>

<Note>
  このエンドポイントは、List から最新の Post を最大 800 件まで返します。
</Note>

***

## 次のステップ

<CardGroup cols={2}>
  <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="List members" icon="https://mintcdn.com/x-preview/SxzTbJaLjs3MidH1/icons/xds/icon-people.svg?fit=max&auto=format&n=SxzTbJaLjs3MidH1&q=85&s=9d5f3f82edcd2a4070364193436e7980" href="/x-api/lists/list-members/introduction" width="24" height="24" data-path="icons/xds/icon-people.svg">
    List のメンバーを取得
  </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/lists/list-tweets/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/lists/get-list-posts" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの詳細ドキュメント
  </Card>
</CardGroup>
