> ## 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 |
| [`get_developer`](#get_developer) | `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.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.account.ensure_(body: { "metadata" => "example" })
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `get_developer`

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.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.account.get_developer
puts response
```

**Returns:** `Hash`

***
