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

# Python XDK

> Python client library for the X API v2.

`xdk` is the official Python SDK for the X API v2. It includes typed Pydantic models, OAuth 2.0 PKCE and OAuth 1.0a auth, cursor pagination, and streaming.

> [card] [PyPI](https://pypi.org/project/xdk/)
>
> `pip install xdk` · Python 3.8+

> [card] [GitHub](https://github.com/xdevplatform/xdk-python)
>
> Source code and issues.

## Quick example

```python theme={null}
import os
from xdk import Client

client = Client(bearer_token=os.environ["X_BEARER_TOKEN"])

for page in client.posts.search_recent(query="from:XDevelopers", max_results=10):
    if page.data:
        for post in page.data:
            print(post.id, post.text)
    break
```

## Guides

> [card] [Install](https://docs.x.com/xdks/python/install.md)
>
> Install with pip, uv, or poetry.

> [card] [Quickstart](https://docs.x.com/xdks/python/quickstart.md)
>
> Run your first search query.

> [card] [Authentication](https://docs.x.com/xdks/python/authentication.md)
>
> Bearer Token, OAuth 2.0 PKCE, and OAuth 1.0a.

> [card] [Pagination](https://docs.x.com/xdks/python/pagination.md)
>
> Iterate across multi-page endpoints.

> [card] [Streaming](https://docs.x.com/xdks/python/streaming.md)
>
> Filtered streams and rule management.

> [card] [API Reference](https://docs.x.com/xdks/python/reference/overview.md)
>
> Methods and parameters for each client.
