> ## Documentation Index
> Fetch the complete documentation index at: https://docs.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 Kotlin, and transfer ownership.

> [!NOTE]
>
> Business Accounts are in **early access**. See [Business Accounts](https://docs.dynamic.xyz/docs/business-accounts/accounts.md) for the model.

Members control who can administer the account. That is separate from [who can sign](https://docs.dynamic.xyz/docs/kotlin/business-accounts/manage-signers.md). `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. |

> [!NOTE]
>
> Adding someone as a member does not let them sign, and adding a signer does not grant admin rights. When a signer becomes active, they are added as a `viewer` member if they are not already a member.

## Who can call what

Every method acts on behalf of the signed-in user. Reads require membership, and modifications such as adding members or signers, linking wallets, and transferring ownership require the owner or admin role. A call made without the required role fails, so check `detail.members` for the caller's role before you show those actions in your UI.

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

```kotlin theme={"system"}
import com.dynamic.sdk.android.DynamicSDK
import com.dynamic.sdk.android.Models.BusinessAccountMemberRole
import com.dynamic.sdk.android.Models.BusinessAccountSignerIdentifierType

val sdk = DynamicSDK.getInstance()

val member = sdk.businessAccounts.addMember(
    businessAccountId = account.id,
    identifier = "admin@acme.com",
    identifierType = BusinessAccountSignerIdentifierType.email,
    role = BusinessAccountMemberRole.admin
)

println(member.userId)
```

**businessAccountId** `String` *required*

The account to add the member to.

**userId** `String?`

A known Dynamic user ID. Use this instead of `identifier`.

**identifier** `String?`

An email, phone number, or other identifier for the user.

**identifierType** `BusinessAccountSignerIdentifierType?`

How to read `identifier`: `email`, `phoneNumber`, `externalUserId`, `socialUsername`, `socialAccountId`, or `id`.

**role** `BusinessAccountMemberRole?`

`admin` or `viewer`. Defaults to `viewer`.

## List members

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

```kotlin theme={"system"}
val detail = sdk.businessAccounts.get(businessAccountId = account.id)

detail.members.forEach { member ->
    println("${member.userId}: ${member.role.name}")
}
```

## Change a member's role

`updateMemberRole` moves a member between `admin` and `viewer`. To change who the owner is, transfer ownership instead.

```kotlin theme={"system"}
val updated = sdk.businessAccounts.updateMemberRole(
    businessAccountId = account.id,
    userId = member.userId,
    role = BusinessAccountMemberRole.viewer
)
```

## Remove a member

```kotlin theme={"system"}
val removed = sdk.businessAccounts.removeMember(
    businessAccountId = account.id,
    userId = member.userId
)
```

> [!TIP]
>
> Removing a member also tears down any [signer](https://docs.dynamic.xyz/docs/kotlin/business-accounts/manage-signers.md) entries they held on the account's wallets, so they lose signing access too, not just admin rights.

## Transfer ownership

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

```kotlin theme={"system"}
val detail = sdk.businessAccounts.transferOwnership(
    businessAccountId = account.id,
    newOwnerUserId = 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.

## Custom roles

A business account can also define custom roles that inherit `admin` or `viewer`, such as `cfo` or `treasurer`. Custom roles are defined, assigned, and deleted by name with the [JavaScript SDK](https://docs.dynamic.xyz/docs/javascript/reference/business-accounts/custom-roles.md); `BusinessAccountMemberRole` here takes only the built-in values. A member holding a custom role reports its inherited built-in role.

## Next steps

> [card] [Manage signers](https://docs.dynamic.xyz/docs/kotlin/business-accounts/manage-signers.md)
>
> Grant and revoke signing access per wallet.

> [card] [Sign transactions](https://docs.dynamic.xyz/docs/kotlin/business-accounts/signing.md)
>
> Sign with a business-account wallet.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.