---
title: "Members"
description: "`members.list`, `get`, `add`, `update`, `remove`, `grantAddress` and `revokeAddress`."
url: "https://openemail.uk/docs/sdk/members"
area: "SDK"
category: "Mailbox"
---

# Members

`members.list`, `get`, `add`, `update`, `remove`, `grantAddress` and `revokeAddress`.

## Every method

**members.ts**

```
const people = await openemail.members.list()
const member = await openemail.members.get(people[0]!.userId)

const sam = await openemail.members.add({
  email: 'sam@acme.com',
  roleId: support.id,
  addressIds: ['2b81de07-…'],
  access: 'member',
})

await openemail.members.update(sam.userId, { roleId: viewerRoleId })

await openemail.members.grantAddress(sam.userId, {
  addressId: 'c40a95f2-…',
  access: 'viewer',
})
await openemail.members.revokeAddress(sam.userId, 'c40a95f2-…')

await openemail.members.remove(sam.userId)
```

Two grants per person and they must not be collapsed. `role` is what they may do; `addresses` is what they may do it to. Both have to agree: a role holding `emails:send` with `access: "viewer"` on invoices@ is somebody who may send mail and may not send it from that address.

Every method takes the `userId`, not the email. `add` is the one exception, and it is the reason for the exception: its caller has an email address and no user id yet, which is the whole first half of what that call does.

> `implied: true` means nobody chose the role. They hold addresses and no role row, so it was inferred from the widest grant they have. Treat it as “not decided yet”, and `update` is what turns the inference into a decision. Until then, widening their address access silently widens what they may do.

> The workspace owner is the first row, marked `isOwner: true`, while `add`, `update` and `remove` still refuse them with `member_is_owner`. An unshared workspace reports one member rather than none, so exclude `isOwner` when you are counting seats.

> `remove` takes both axes, the role AND every address grant on this workspace, and reports `addressesRevoked`. `revokeAddress` is the narrow one, for somebody who moved team rather than somebody who left.

## Parameters

- `email` (string, required): Who to invite, trimmed and lower-cased. It does not need an account yet: everybody is invited, and the role and grants land when they accept. Somebody already in the workspace is `member_is_owner` (422).
- `roleId` (string, required): The role they will hold, 1 to 128 characters, and it must be a role on this workspace: an unknown id is `role_not_found` (404). The owner role cannot be handed out and comes back `role_immutable` (409), because making somebody an owner is a workspace transfer and there is no call for that here.
- `addressIds` (string[]): Addresses to hand over in the same call, at most 64 ids of 1 to 128 characters each; an id that is not an address on this workspace is refused. The role is written first and the grants follow one at a time, so a bad id leaves the member created with fewer addresses than you asked for. Re-posting the same body is the fix, since both writes upsert.
- `access` ('member' | 'viewer'): What they may do with every id in `addressIds`: `member` reads the address and sends as it, `viewer` only reads it. Defaults to `member`, the level the console and the older sharing path have always used, so the same call means the same thing from a script and from a screen; grant a mixture by calling `grantAddress` afterwards for the ones that differ.

## Response

- `object` ('member'): Always `member`. A removal answers with the same value, their `userId`, `deleted: true` and `addressesRevoked`, and none of the other fields below.
- `userId` (string): Their account id, and the handle every other member call takes in the path: get, update, remove and both address calls. Adding somebody is the one call that works from an email instead, because whoever is adding a colleague knows their address and not their id.
- `email` (string): The email on their account, echoed as that row stores it. This resource never writes it, and the lower-casing on `add` applies to the address you send for the lookup rather than to what comes back. After the owner, the members list is sorted by it rather than by when people joined, because the list is read to find one person rather than to see what changed.
- `name` (string | null): Their display name, taken from their account, where the column is NOT NULL. The null in the type is defensive rather than a state this API has been seen to produce. It belongs to them rather than to the workspace, so nothing on this resource can set it.
- `image` (string | null): Their avatar, taken from their account, and null when they have not set one.
- `role.id` (string | null): The id of the role they hold, or null when nobody chose it. See `implied`. A null here is the one case where `role` reports an inference rather than a decision somebody made.
- `role.name` (string): The role's name. For an implied member it is the name of the built-in template their access resolved to, not a row on this workspace.
- `role.builtin` ('owner' | 'admin' | 'member' | 'viewer' | 'developer' | 'billing' | null): Which built-in the role is, or null for a custom one. `owner` appears only on the owner's own row, alongside `isOwner: true`; assigning that role to anybody is refused with `role_immutable` (409).
- `isOwner` (boolean): True on exactly one row, the account the workspace is keyed on. They hold every permission whatever their role row says, they sort first, and `add`, `update` and `remove` all refuse them with `member_is_owner`. Exclude them when you are counting seats.
- `implied` (boolean): True when this person has address grants and no member row, so their role was inferred rather than chosen: any grant of `member` resolves to the built-in Member, otherwise Viewer. Never true for the owner. Show it as "implied by access". Until a PATCH turns the inference into a decision, widening their address access silently widens what they may do.
- `permissions` (Permission[]): The role's permissions flattened onto the member, so one read answers "may they?" without fetching the role. For an implied member they come from the built-in TEMPLATE rather than from this workspace's role row, so editing the built-in Member role does not change what an implied member holds.
- `addresses` (MemberAddress[]): The addresses they have been given, sorted by address, each with its own access level. Empty for somebody holding a role and no grants, which is what a new member looks like until an address is granted, and is the right failure to have while you are still deciding what they should see.
- `addresses[].addressId` (string): The id of the address, and what `grantAddress` and `revokeAddress` take. An id that is not an address on this workspace is refused on both, rather than reporting a revocation that never happened.
- `addresses[].address` (string): The full address, lower-cased, rebuilt from its local part and its domain.
- `addresses[].access` ('member' | 'viewer'): What they may do with this one address: `member` reads it and sends as it, `viewer` only reads it. This and the role both have to allow a send before one happens, so a role holding `emails:send` over a `viewer` grant sends from nothing; the stored column is called `role`, and it is renamed here so one object does not carry two `role`s drawn from two vocabularies.
- `createdAt` (string | null): When their member row was written, ISO-8601, and null when there is no member row at all. That null describes the same population as `implied: true`: people who hold addresses from before roles existed and whom nobody has since given a role.
