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

# AccountClient

> Methods for X API v2 Account endpoints.

Access **Account** endpoints via `client.account()` (`AccountClient`).

## Methods

| Method | Endpoint | Behavior | Summary |
| :- | :- | :- | :- |
| [`ensure`](#ensure) | `POST /2/account` | Standard | Ensure Developer Account |
| [`getDeveloper`](#getdeveloper) | `GET /2/account` | Standard | Get Developer Account |

## `ensure`

POST `/2/account`

**Ensure Developer Account**

Creates an X Developer Platform account for the authenticated user if they do not already have one, and returns it. Idempotent: when the user already has an account it is returned unchanged with `created` false.

```java theme={null}
import com.x.xdk.Schemas;
import com.x.xdk.XClient;

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.account().ensure(new Schemas.EnsureAccountRequest().metadata("example"));
System.out.println(response);
```

### Parameters

**body** `Schemas.EnsureAccountRequest` *required*

Request payload.

**Returns:** `Schemas.EnsureAccountResponse`

***

## `getDeveloper`

GET `/2/account`

**Get Developer Account**

Returns the X Developer Platform account that is billed for the authenticated user's API access. A user with no such account gets a resource-not-found error entry.

```java theme={null}
import com.x.xdk.XClient;

XClient client = XClient.builder()
    .accessToken(System.getenv("X_ACCESS_TOKEN"))
    .build();

var response = client.account().getDeveloper();
System.out.println(response);
```

**Returns:** `Schemas.GetDeveloperAccountResponse`

***
