Invite people to a team organization
v1.6.0 adds member management to the console API. Chat requests and the existing console routes behave as they did in v1.5.0.
Listing members
GET /console/v1/orgs/{org}/members answers for any member of the organization with its members and their roles. Owners and admins also see the open invitations. A member's email address is recorded the next time that member calls the console API, so it can be missing until then.
Removing a member
DELETE /console/v1/orgs/{org}/members/{user} removes a member. Owners and admins can remove members, only the owner can remove an admin, and the owner cannot be removed. Any member can remove themself to leave an organization, except the owner. Role changes are not supported: remove the member and invite them again.
Inviting by email address
An owner or admin invites an address with POST /console/v1/orgs/{org}/invitations, sending an email and a role of admin or member. Only the owner can invite an admin; an admin who tries gets 403. Personal organizations cannot have invitations and answer 400, as does an invalid address or role. An invitation expires after 14 days. There is one open invitation per address, so inviting the same address again refreshes its role and expiry instead of adding a second one. If the address already belongs to a member, the request answers the new 409 conflict. DELETE /console/v1/orgs/{org}/invitations/{id} revokes an open invitation. No email is sent: the invitee sees the invitation in the console.
Accepting an invitation
The invitee lists their open invitations with GET /console/v1/invitations and answers one with POST /console/v1/invitations/{id}/accept or /decline. This needs a signed-in account whose email address is confirmed and matches the invited address. Anything else answers 404, as a missing invitation does. Accepting makes the caller a member with the invited role. Every invite, revoke, join, remove and leave is recorded in the organization's audit log.