Skip to the documentation
TypeScript

Members

`members.list`, `listAll`, `iterate`, `get`, `add`, `update`, `remove`, `grantAddress`, `revokeAddress`, and the invitation methods beside them.

Every method

members.ts
const invitation = await openemail.members.add({  email: '[email protected]',  roleId: support.id,  addressIds: ['2b81de07-…'],  access: 'member',}) const people = await openemail.members.listAll()const sam = people.find((person) => person.email === '[email protected]')!const member = await openemail.members.get(sam.userId) 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. The exception is a role holding addresses:all, which reaches every address whatever addresses lists, because that array holds only direct grants, so check permissions before reading it as the whole of somebody’s reach.

Every method takes the userId, not the email. add is the one exception, because it invites an address: the person has a userId only once they accept, and listInvitations follows the invitation until then.

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

emailstringrequired
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).
roleIdstringrequired
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.
addressIdsstring[]
Addresses the invitation carries, at most 64 ids of 1 to 128 characters each, granted when it is accepted. Every id is checked before anything is written, so one that is not an address on this workspace refuses the whole call with 422 `member_not_found` and nothing is sent. Inviting the same address again within ten minutes is 409 `invitation_too_soon`.
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.
userIdstring
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.
emailstring
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.
namestring | 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.
imagestring | null
Their avatar, taken from their account, and null when they have not set one.
role.idstring | 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.namestring
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).
isOwnerboolean
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.
impliedboolean
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.
permissionsPermission[]
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.
addressesMemberAddress[]
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[].addressIdstring
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[].addressstring
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.
createdAtstring | 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.

Invitations

invitations.ts
const waiting = await openemail.members.listAllInvitations() for (const invitation of waiting) {  if (invitation.expired) await openemail.members.resendInvitation(invitation.id)} await openemail.members.revokeInvitation('winv_6bb640f5b99e47deb758f1f5')

add answers with an invitation, and these are the calls that follow one up: listInvitations, listAllInvitations and iterateInvitations read the ones nobody has accepted yet, resendInvitation sends one again with a new link and fourteen more days, and revokeInvitation withdraws it. A waiting invitation grants nothing until it is accepted.

resendInvitation refuses the same address twice within ten minutes with 409 invitation_too_soon, and revokeInvitation refuses one that was accepted first with 409 invitation_accepted.