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

# Create a Business Account

> Create a business account in Flutter, then list, read, and rename it.

<Note>
  Business Accounts are in **early access**. See the [overview](/docs/flutter/business-accounts/overview) for the model.
</Note>

Create a business account as an authenticated user. You become the **owner**, and can then add [wallets](/docs/flutter/business-accounts/add-wallets), [signers](/docs/flutter/business-accounts/manage-signers), and [members](/docs/flutter/business-accounts/members-and-roles).

## Create an account

`create` takes an optional `name`, `externalRef`, and `metadata`, and returns the new account.

```dart theme={"system"}
import 'package:dynamic_sdk/dynamic_sdk.dart';

final sdk = DynamicSDK.instance;

final account = await sdk.businessAccounts.create(
  name: 'Acme Treasury',
  externalRef: 'org_acme_123',
  metadata: {'tier': 'enterprise'},
);

print(account.id); // use this to add wallets, signers, and members
```

<ParamField path="name" type="String?">
  Display name for the account.
</ParamField>

<ParamField path="externalRef" type="String?">
  A developer-supplied label for mapping your own org or tenant ID onto this account. Not unique, so multiple accounts may share a value.
</ParamField>

<ParamField path="metadata" type="Map<String, dynamic>?">
  Arbitrary key-value metadata stored alongside the account.
</ParamField>

The returned `BusinessAccount` has `id`, `name`, `externalRef`, `metadata`, `projectEnvironmentId`, `createdAt`, and `updatedAt`.

## List accounts

`list` returns the accounts the current user is a member of, for the active environment. Pass `externalRefs` to filter by your own org or tenant IDs.

```dart theme={"system"}
final list = await sdk.businessAccounts.list();

for (final account in list.items ?? []) {
  print(account.name ?? account.id);
}

// Filter by your own references
final filtered = await sdk.businessAccounts.list(
  externalRefs: ['org_acme_123'],
);
```

`BusinessAccountList` returns `items` plus a `nextCursor` for paging.

## Read one account

`get` returns the account plus its `members`, `signers`, and `wallets`.

```dart theme={"system"}
final detail = await sdk.businessAccounts.get(
  businessAccountId: account.id,
);

print(detail.members.length);
print(detail.signers.length);
print(detail.wallets?.length ?? 0);
```

Each entry in `detail.wallets` is a `BusinessAccountWalletSummary` with `id`, `chain`, and `publicKey`. Use the `id` when you [add or remove wallets](/docs/flutter/business-accounts/add-wallets) and when you [manage signers](/docs/flutter/business-accounts/manage-signers).

<Tip>
  Only members of an account can read it. A request from a non-member returns 404 rather than 403, so account existence is not leaked across tenants.
</Tip>

## Rename an account

`update` changes the account name.

```dart theme={"system"}
final renamed = await sdk.businessAccounts.update(
  businessAccountId: account.id,
  name: 'Acme Operating Funds',
);
```

## On error

Every method returns a `Future` that throws on failure. Wrap calls in `try/catch` and show the failure to the user:

```dart theme={"system"}
try {
  final account = await sdk.businessAccounts.create(name: 'Acme Treasury');
  print(account.id);
} catch (e) {
  print('Failed to create business account: $e');
}
```

## Next steps

<CardGroup cols={2}>
  <Card title="Add wallets" icon="wallet" href="/docs/flutter/business-accounts/add-wallets">
    Link an embedded wallet to the account.
  </Card>

  <Card title="Members and roles" icon="users" href="/docs/flutter/business-accounts/members-and-roles">
    Add admins and viewers, and transfer ownership.
  </Card>
</CardGroup>
