> ## 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.

# Members and Roles

> Administer who can manage a business account from Unity, and transfer ownership.

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

Members control who can administer the account. That is separate from [who can sign](/docs/unity/business-accounts/manage-signers). `BusinessAccountMemberRole` has three values:

| Role     | Can do                                                                 |
| -------- | ---------------------------------------------------------------------- |
| `Owner`  | Everything, including transferring ownership. Exactly one per account. |
| `Admin`  | Add and remove members and signers, and link wallets.                  |
| `Viewer` | Read-only access.                                                      |

<Info>
  Adding someone as a member does not let them sign, and adding a signer does not grant admin rights. Grant each explicitly.
</Info>

## Add a member

`AddMember` adds a member as `Admin` or `Viewer` (it defaults to `Viewer`). Identify them with a known `userId`, or with an `identifier` plus `identifierType`, in which case the user is created if they do not exist yet.

```csharp theme={"system"}
using DynamicSDK.Models.BusinessAccounts;
using UnityEngine;

var member = await DynamicSDK.Instance.BusinessAccounts.AddMember(
    businessAccountId: account.Id,
    identifier: "admin@acme.com",
    identifierType: BusinessAccountSignerIdentifierType.Email,
    role: BusinessAccountMemberRole.Admin);

Debug.Log(member.UserId);
```

<ParamField path="businessAccountId" type="string" required>
  The account to add the member to.
</ParamField>

<ParamField path="userId" type="string">
  A known Dynamic user ID. Use this instead of `identifier`.
</ParamField>

<ParamField path="identifier" type="string">
  An email, phone number, or other identifier for the user.
</ParamField>

<ParamField path="identifierType" type="BusinessAccountSignerIdentifierType?">
  How to read `identifier`: `Email`, `PhoneNumber`, `ExternalUserId`, `SocialUsername`, `SocialAccountId`, or `Id`.
</ParamField>

<ParamField path="role" type="BusinessAccountMemberRole?">
  `Admin` or `Viewer`. Defaults to `Viewer`.
</ParamField>

## List members

`Get` returns the account with its members, including each member's role.

```csharp theme={"system"}
var detail = await DynamicSDK.Instance.BusinessAccounts.Get(account.Id);

foreach (var member in detail.Members)
{
    Debug.Log($"{member.UserId}: {member.Role}");
}
```

## Change a member's role

`UpdateMemberRole` moves a member between `Admin` and `Viewer`. To change who the owner is, transfer ownership instead.

```csharp theme={"system"}
var updated = await DynamicSDK.Instance.BusinessAccounts.UpdateMemberRole(
    account.Id, member.UserId, BusinessAccountMemberRole.Viewer);
```

## Remove a member

```csharp theme={"system"}
var removed = await DynamicSDK.Instance.BusinessAccounts.RemoveMember(
    account.Id, member.UserId);
```

<Tip>
  Removing a member also tears down any [signer](/docs/unity/business-accounts/manage-signers) entries they held on the account's wallets, so they lose signing access too, not just admin rights.
</Tip>

## Transfer ownership

`TransferOwnership` promotes an existing member to owner and demotes the current owner to `Admin` in the same operation. Owner only.

```csharp theme={"system"}
var detail = await DynamicSDK.Instance.BusinessAccounts.TransferOwnership(
    account.Id, newOwnerUserId);
```

<Warning>
  Transferring ownership revokes the caller's session server-side, because their scope changed from owner to admin. The previous owner is signed out and must re-authenticate to pick up the new role. The new owner must already be a member.
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Manage signers" icon="key" href="/docs/unity/business-accounts/manage-signers">
    Grant and revoke signing access per wallet.
  </Card>

  <Card title="Sign transactions" icon="signature" href="/docs/unity/business-accounts/signing">
    Sign with a business-account wallet.
  </Card>
</CardGroup>
