> ## 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 |
| :- | :- | :- | :- |
| [`EnsureAsync`](#ensureasync) | `POST /2/account` | Standard | Ensure Developer Account |
| [`GetDeveloperAsync`](#getdeveloperasync) | `GET /2/account` | Standard | Get Developer Account |

## `EnsureAsync`

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.

```csharp theme={null}
using System;
using Xdk;
using Xdk.Models;

using var client = new XClient(new XClientOptions
{
    AccessToken = Environment.GetEnvironmentVariable("X_ACCESS_TOKEN"),
});

var response = await client.Account.EnsureAsync(new EnsureAccountRequest { Metadata = "example" });
Console.WriteLine(response);
```

### Parameters

**body** `EnsureAccountRequest` *required*

Request payload.

**Returns:** `Task<EnsureAccountResponse>`

***

## `GetDeveloperAsync`

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.

```csharp theme={null}
using System;
using Xdk;

using var client = new XClient(new XClientOptions
{
    AccessToken = Environment.GetEnvironmentVariable("X_ACCESS_TOKEN"),
});

var response = await client.Account.GetDeveloperAsync();
Console.WriteLine(response);
```

**Returns:** `Task<GetDeveloperAccountResponse>`

***
