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

# Quickstart

> This guide walks you through looking up List information using the List lookup endpoints. Reference for the Enterprise X API tier covering list lookup.

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

This guide walks you through looking up List information using the List lookup endpoints.

<Note>
  **Prerequisites**

  Before you begin, you'll need:

  * A [developer account](https://developer.x.com/en/portal/petition/essential/basic-info) with an approved App
  * Your App's Bearer Token
</Note>

***

## Get a List by ID

Retrieve details for a specific List:

<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")

  # Get a List by 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" });

  // Get a List by 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>

### Response

```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"
  }
}
```

***

## Get Lists owned by a user

Retrieve all Lists owned by a specific user:

<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")

  # Get Lists owned by a user with pagination
  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" });

  // Get Lists owned by a user with pagination
  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>

### Response

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

***

## Include owner information

Expand the owner's user data:

<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")

  # Get List with owner info
  response = client.lists.get(
      "1234567890",
      list_fields=["description", "owner_id"],
      expansions=["owner_id"],
      user_fields=["username", "verified"]
  )

  print(f"List: {response.data.name}")
  # Owner info is in response.includes.users
  ```

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

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

  // Get List with owner info
  const response = await client.lists.get("1234567890", {
    listFields: ["description", "owner_id"],
    expansions: ["owner_id"],
    userFields: ["username", "verified"],
  });

  console.log(`List: ${response.data?.name}`);
  // Owner info is in response.includes?.users
  ```
</CodeGroup>

### Response with expansion

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

***

## Available fields

| Field            | Description             |
| :--------------- | :---------------------- |
| `description`    | List description        |
| `owner_id`       | Owner's user ID         |
| `private`        | Whether List is private |
| `member_count`   | Number of members       |
| `follower_count` | Number of followers     |
| `created_at`     | List creation date      |

***

## Next steps

<CardGroup cols={2}>
  <Card title="List Posts" icon="list" href="/x-api/lists/list-tweets/quickstart">
    Get Posts from a List
  </Card>

  <Card title="List members" icon="users" href="/x-api/lists/list-members/quickstart/list-members-lookup">
    Get List members
  </Card>

  <Card title="Manage Lists" icon="pen" href="/x-api/lists/manage-lists/quickstart">
    Create and update Lists
  </Card>

  <Card title="API Reference" icon="code" href="/x-api/lists/list-lookup-by-list-id">
    Full endpoint documentation
  </Card>
</CardGroup>
