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

# useListAccounts

> Hook to retrieve all accounts connected to a WaaS session.

## Import

```tsx theme={null}
import { useListAccounts } from '@0xsequence/connect'
```

## Usage

```tsx theme={null}
import { useListAccounts } from '@0xsequence/connect'

function AccountsList() {
  const { data, isLoading, error, refetch } = useListAccounts()

  if (isLoading) return <div>Loading accounts...</div>
  if (error) return <div>Error: {error.message}</div>

  return (
    <div>
      <button onClick={() => refetch()}>Refresh Accounts</button>
      <div>Current Account ID: {data?.currentAccountId}</div>
      {data?.accounts.map(account => (
        <div key={account.id} className="account-item">
          <div>ID: {account.id}</div>
          <div>Type: {account.type}</div>
          {account.email && <div>Email: {account.email}</div>}
          {account.issuer && <div>Issuer: {account.issuer}</div>}
        </div>
      ))}
    </div>
  )
}
```

## Return Type

```tsx theme={null}
interface UseListAccountsResult {
  data?: IntentResponseAccountList
  isLoading: boolean
  error: Error | null
  refetch: () => Promise<void>
}

enum IdentityType {
    None = "None",
    Guest = "Guest",
    OIDC = "OIDC",
    Email = "Email",
    PlayFab = "PlayFab",
    Stytch = "Stytch"
}

interface Account {
    id: string;
    type: IdentityType;
    issuer?: string;
    email?: string;
}

interface IntentResponseAccountList {
    accounts: Array<Account>;
    currentAccountId: string;
}
```

### Properties

| Property    | Type                                     | Description                                                                     |
| ----------- | ---------------------------------------- | ------------------------------------------------------------------------------- |
| `data`      | `IntentResponseAccountList \| undefined` | The account list, including `currentAccountId` and an array of account objects. |
| `isLoading` | `boolean`                                | Indicates whether the query is in progress.                                     |
| `error`     | `Error \| null`                          | Any error encountered during retrieval.                                         |
| `refetch`   | `() => Promise<void>`                    | Manually triggers a refresh of the account list.                                |

Data is fetched automatically when the WaaS connection becomes available and is cached for one minute.
