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

# Quickstart

> Make your first X API v2 request with the Python XDK.

**1. Install the SDK**

```bash theme={null}
pip install xdk
```

**2. Export your Bearer Token**

Generate a **Bearer Token** in the [X Developer Console](https://console.x.com) and set it in your shell:

```bash theme={null}
export X_BEARER_TOKEN="your_bearer_token_here"
```

**3. Run a search**

Save this as `quickstart.py`:

```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:
        print(page.data[0].text)
    else:
        print("No posts found.")
    break
```

Run it:

```bash theme={null}
python quickstart.py
```

## Next steps

* [Authentication](https://docs.x.com/xdks/python/authentication.md) — Bearer Token, OAuth 2.0 PKCE, and OAuth 1.0a
* [Pagination](https://docs.x.com/xdks/python/pagination.md) — Fetch multiple pages with iterators
* [Streaming](https://docs.x.com/xdks/python/streaming.md) — Read real-time filtered and sampled streams
* [Code samples](https://github.com/xdevplatform/samples/tree/main/python) — Runnable Python examples
