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

# クイックスタート

> ID または所有者を指定してリストを取得する

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <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 lookup エンドポイントを使ってリスト情報を取得する方法を説明します。

<Note>
  **前提条件**

  作業を始める前に、次のものが必要です。

  * 承認済みの App を持つ[開発者アカウント](https://developer.x.com/en/portal/petition/essential/basic-info)
  * App のベアラートークン
</Note>

***

<div id="get-a-list-by-id">
  ## ID でリストを取得する
</div>

特定のリストの詳細情報を取得します。

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/lists/1234567890?\
  list.fields=description,owner_id,member_count,follower_count,private,created_at" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # ID でリストを取得する
  response = client.lists.get(
      "1234567890",
      list_fields=["description", "owner_id", "member_count", "follower_count", "private", "created_at"]
  )

  print(f"List: {response.data.name}")
  print(f"Members: {response.data.member_count}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

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

  // ID でリストを取得する
  const response = await client.lists.get("1234567890", {
    listFields: ["description", "owner_id", "member_count", "follower_count", "private", "created_at"],
  });

  console.log(`List: ${response.data?.name}`);
  console.log(`Members: ${response.data?.member_count}`);
  ```
</CodeGroup>

<div id="response">
  ### レスポンス
</div>

```json theme={null}
{
  "data": {
    "id": "1234567890",
    "name": "Tech News",
    "description": "Top tech journalists and publications",
    "owner_id": "2244994945",
    "private": false,
    "member_count": 50,
    "follower_count": 1250,
    "created_at": "2023-01-15T10:00:00.000Z"
  }
}
```

***

<div id="get-lists-owned-by-a-user">
  ## ユーザーが所有するリストを取得する
</div>

特定のユーザーが所有しているすべてのリストを取得します。

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/users/2244994945/owned_lists?\
  list.fields=description,member_count,follower_count&\
  max_results=100" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # ページネーションを使用してユーザーが所有するリストを取得します
  for page in client.lists.get_owned_lists(
      "2244994945",
      list_fields=["description", "member_count", "follower_count"],
      max_results=100
  ):
      for lst in page.data:
          print(f"{lst.name} - {lst.member_count} members")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

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

  // ページネーションを使用してユーザーが所有するリストを取得します
  const paginator = client.lists.getOwnedLists("2244994945", {
    listFields: ["description", "member_count", "follower_count"],
    maxResults: 100,
  });

  for await (const page of paginator) {
    page.data?.forEach((lst) => {
      console.log(`${lst.name} - ${lst.member_count} members`);
    });
  }
  ```
</CodeGroup>

<div id="response">
  ### レスポンス
</div>

```json theme={null}
{
  "data": [
    {
      "id": "1234567890",
      "name": "Tech News",
      "description": "Top tech journalists",
      "member_count": 50,
      "follower_count": 1250
    },
    {
      "id": "9876543210",
      "name": "Developer Tools",
      "description": "Useful tools for developers",
      "member_count": 25,
      "follower_count": 500
    }
  ],
  "meta": {
    "result_count": 2
  }
}
```

***

<div id="include-owner-information">
  ## 所有者情報を含める
</div>

所有者のユーザーデータを展開します。

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/lists/1234567890?\
  list.fields=description,owner_id&\
  expansions=owner_id&\
  user.fields=username,verified" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # 所有者情報付きのリストを取得
  response = client.lists.get(
      "1234567890",
      list_fields=["description", "owner_id"],
      expansions=["owner_id"],
      user_fields=["username", "verified"]
  )

  print(f"List: {response.data.name}")
  # 所有者情報は response.includes.users に含まれます
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

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

  // 所有者情報付きのリストを取得
  const response = await client.lists.get("1234567890", {
    listFields: ["description", "owner_id"],
    expansions: ["owner_id"],
    userFields: ["username", "verified"],
  });

  console.log(`List: ${response.data?.name}`);
  // 所有者情報は response.includes?.users に含まれます
  ```
</CodeGroup>

<div id="response-with-expansion">
  ### 拡張を含むレスポンス
</div>

```json theme={null}
{
  "data": {
    "id": "1234567890",
    "name": "Tech News",
    "description": "Top tech journalists",
    "owner_id": "2244994945"
  },
  "includes": {
    "users": [
      {
        "id": "2244994945",
        "username": "XDevelopers",
        "verified": true
      }
    ]
  }
}
```

***

<div id="available-fields">
  ## 使用可能なフィールド
</div>

| フィールド            | 説明           |
| :--------------- | :----------- |
| `description`    | リストの説明       |
| `owner_id`       | オーナーのユーザー ID |
| `private`        | リストが非公開かどうか  |
| `member_count`   | メンバー数        |
| `follower_count` | フォロワー数       |
| `created_at`     | リストの作成日時     |

***

<div id="next-steps">
  ## 次のステップ
</div>

<CardGroup cols={2}>
  <Card title="リストの投稿" icon="list" href="/ja/x-api/lists/list-tweets/quickstart">
    リストから投稿を取得
  </Card>

  <Card title="リストのメンバー" icon="users" href="/ja/x-api/lists/list-members/quickstart/list-members-lookup">
    リストのメンバーを取得
  </Card>

  <Card title="リストを管理" icon="pen" href="/ja/x-api/lists/manage-lists/quickstart">
    リストを作成・更新
  </Card>

  <Card title="APIリファレンス" icon="code" href="/ja/x-api/lists/list-lookup-by-list-id">
    エンドポイントの詳細なドキュメント
  </Card>
</CardGroup>
