> ## 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 & Roles

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

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

Members control who can administer the account. That is separate from [who can sign](/docs/javascript/reference/business-accounts/manage-signers). There are three roles:

| Role     | Can do                                                                 |
| -------- | ---------------------------------------------------------------------- |
| `owner`  | Everything, including transferring ownership. Exactly one per account. |
| `admin`  | Add/remove members and signers, 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. Member and role operations require [step-up authentication](/docs/javascript/reference/business-accounts/step-up-auth).
</Info>

## Add a member

`addBusinessAccountMember` adds a member as `admin` or `viewer` (defaults to `viewer`). Identify them with a `targetIdentity`: a known `userId`, or an `identifier` + `identifierType` (the user is created if absent).

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={"system"}
    import { addBusinessAccountMember } from '@dynamic-labs-sdk/client/waas';

    await addBusinessAccountMember({
      businessAccountId: account.id,
      targetIdentity: { identifier: 'admin@acme.com', identifierType: 'email' },
      role: 'admin',
    });
    ```
  </Tab>

  <Tab title="React">
    ```tsx theme={"system"}
    import { useAddBusinessAccountMember } from '@dynamic-labs-sdk/react-hooks';

    const { mutate } = useAddBusinessAccountMember();
    mutate({ businessAccountId, targetIdentity: { userId: 'user-123' }, role: 'viewer' });
    ```
  </Tab>
</Tabs>

## Change a member's role

`updateBusinessAccountMemberRole` moves a member between `admin` and `viewer`. (Use ownership transfer, below, to change who the owner is.)

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={"system"}
    import { updateBusinessAccountMemberRole } from '@dynamic-labs-sdk/client/waas';

    await updateBusinessAccountMemberRole({
      businessAccountId: account.id,
      userId,
      role: 'admin',
    });
    ```
  </Tab>

  <Tab title="React">
    ```tsx theme={"system"}
    import { useUpdateBusinessAccountMemberRole } from '@dynamic-labs-sdk/react-hooks';

    const { mutate } = useUpdateBusinessAccountMemberRole();
    mutate({ businessAccountId, userId, role: 'viewer' });
    ```
  </Tab>
</Tabs>

## Remove a member

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={"system"}
    import { removeBusinessAccountMember } from '@dynamic-labs-sdk/client/waas';

    await removeBusinessAccountMember({ businessAccountId: account.id, userId });
    ```
  </Tab>

  <Tab title="React">
    ```tsx theme={"system"}
    import { useRemoveBusinessAccountMember } from '@dynamic-labs-sdk/react-hooks';

    const { mutate } = useRemoveBusinessAccountMember();
    mutate({ businessAccountId, userId });
    ```
  </Tab>
</Tabs>

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

## Transfer ownership

`transferBusinessAccountOwnership` promotes an existing member to owner and atomically demotes the current owner to `admin`. Owner-only.

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={"system"}
    import { transferBusinessAccountOwnership } from '@dynamic-labs-sdk/client/waas';

    await transferBusinessAccountOwnership({
      businessAccountId: account.id,
      newOwnerUserId,
    });
    ```
  </Tab>

  <Tab title="React">
    ```tsx theme={"system"}
    import { useTransferBusinessAccountOwnership } from '@dynamic-labs-sdk/react-hooks';

    const { mutate } = useTransferBusinessAccountOwnership();
    mutate({ businessAccountId, newOwnerUserId });
    ```
  </Tab>
</Tabs>

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