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

# Java XDK

> Java client library for the X API v2.

`com.x:xdk` is the official Java SDK for the X API v2 (Java 17+ and Kotlin). It includes typed models, OAuth 2.0 PKCE and OAuth 1.0a auth, `Paginator<T>`, and `EventStream<T>`.

> [card] [Maven Central](https://central.sonatype.com/artifact/com.x/xdk)
>
> `com.x:xdk:0.1.2` · Java 17+

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

## Quick example

```java theme={null}
import com.x.xdk.Schemas;
import com.x.xdk.XClient;
import com.x.xdk.clients.UsersClient;
import java.util.List;

public class Example {
    public static void main(String[] args) {
        XClient client = XClient.builder()
            .bearerToken(System.getenv("X_BEARER_TOKEN"))
            .build();

        Schemas.GetUsersByUsernameResponse response = client.users().getByUsername(
            "XDevelopers",
            UsersClient.GetByUsernameOptions.builder()
                .userFields(List.of("created_at", "public_metrics"))
        );
        System.out.println(response.getData());
    }
}
```

## Guides

> [card] [Install](https://docs.x.com/xdks/java/install.md)
>
> Add `com.x:xdk` with Maven or Gradle.

> [card] [Quickstart](https://docs.x.com/xdks/java/quickstart.md)
>
> Make your first request.

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

> [card] [Pagination](https://docs.x.com/xdks/java/pagination.md)
>
> Iterate pages with `Paginator<T>`.

> [card] [Streaming](https://docs.x.com/xdks/java/streaming.md)
>
> Read live streams with `EventStream<T>`.

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