> ## Documentation Index
> Fetch the complete documentation index at: https://public-perps-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# getAccount

> Fetch account balances, margin, and fee tier

Returns the account summary for a DEX including balances, margin, and fee tier.

<Info>
  The examples on this page use **Hyperliquid** (`provider: 'hyperliquid'`). Replace the `provider` value with any supported DEX from `getProviders()`.
</Info>

```typescript theme={null}
import { getAccount } from '@lifi/perps-sdk';

const account = await getAccount(client, {
  provider: 'hyperliquid',
  address: userAddress,
});

console.log('Balances:', account.balances); // Balance[]
console.log('Collateral:', account.collateralBalances); // Balance[]
console.log('Margin used:', account.marginUsed);
console.log('Unrealized PnL:', account.unrealizedPnl);
```

## Parameters

| Parameter         | Type                | Required | Description                           |
| ----------------- | ------------------- | -------- | ------------------------------------- |
| `client`          | `PerpsSDKClient`    | Yes      | SDK client from `createPerpsClient()` |
| `params.provider` | `string`            | Yes      | DEX identifier                        |
| `params.address`  | `string`            | Yes      | User's wallet address                 |
| `options`         | `SDKRequestOptions` | No       | Request options                       |

## Returns

`AccountResponse`:

| Field                | Type            | Description                                                                                                                                                                                                                           |
| -------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `provider`           | `string`        | Provider identifier                                                                                                                                                                                                                   |
| `address`            | `string`        | User's wallet address                                                                                                                                                                                                                 |
| `balances`           | `Balance[]`     | Flat, non-collateral holdings                                                                                                                                                                                                         |
| `collateralBalances` | `Balance[]`     | SDK-determined collateral subset (spot balances in a category's quote asset)                                                                                                                                                          |
| `marginUsed`         | `string`        | Margin currently in use                                                                                                                                                                                                               |
| `unrealizedPnl`      | `string`        | Total unrealized PnL                                                                                                                                                                                                                  |
| `feeTier`            | `FeeTier`       | Maker and taker fee rates                                                                                                                                                                                                             |
| `config`             | `AccountConfig` | Provider-specific account state — a discriminated union over `provider`. Narrow with `config.provider === 'hyperliquid'` / `'lighter'` to access provider-specific fields. See [AccountConfig](/api-reference/account#accountconfig). |

Each `Balance`:

| Field        | Type     | Description                                                                 |
| ------------ | -------- | --------------------------------------------------------------------------- |
| `categoryId` | `string` | Which category/venue this balance sits in — references a `ProviderCategory` |
| `asset`      | `Asset`  | The held asset                                                              |
| `units`      | `string` | Amount held, in asset units                                                 |
| `valueUsd`   | `string` | USD value of the holding                                                    |

<Info>
  Positions and orders are fetched separately via [`getPositions()`](/sdk/account/get-positions) and [`getOrders()`](/sdk/account/get-orders).
</Info>

## accountExists

Thin existence check for a provider account at `address` — useful for gating signing-mode or onboarding flows on whether the user has any account state with the provider yet.

```typescript theme={null}
const exists = await perps.accountExists('hyperliquid', userAddress);
```

| Parameter  | Type     | Required | Description           |
| ---------- | -------- | -------- | --------------------- |
| `provider` | `string` | Yes      | DEX identifier        |
| `address`  | `string` | Yes      | User's wallet address |

**Returns:** `Promise<boolean>` — `true` when `getAccount` resolves, `false` when the backend reports `PerpsErrorCode.AccountNotFound`. Any other error (transport, validation, server) is re-thrown.

**API Reference:** [GET /account](/api-reference/account#getaccount)
