foliot docs

API reference / Workspaces / Invite a person to a workspace

Invite a person to a workspace

POST/workspaces/{workspaceId}/invitations

Authenticate with an operator token or a signed-in Foliot Console session.

An owner of the workspace, or an operator token; a member below owner is 403, and a workspace the caller is not in answers 404, exactly as one that does not exist. An app key may not. Records a pending invitation for the address with the role chosen. The person is added when they sign in with that address verified; an invitation never changes someone who is already a member. It expires after 14 days. This call never adds anyone, and it answers with the same status and body whether or not the address has an account (the time taken differs: an address with an account needs fewer calls to Clerk): when the server has an email service configured, an address with no account is emailed an invitation to sign up, and an address that already has one is sent nothing and is let in the next time that person opens Foliot Console. 409 if that address already has a pending invitation here (cancel it to send another) or the workspace already has 100 pending. 429 when the workspace has recorded its share of invitations in the last hour (30), or has recorded three for this address in the last day, cancelled or not: invitations are emails from the instance, and a loop of invite and cancel would otherwise send without bound. The place is taken before anything is sent, so concurrent requests cannot exceed it; it is counted from the workspace’s own record and for every address alike, so it says nothing about whether the address has an account. Nothing was sent, so try again later. 503 if the email service could not be reached: nothing was recorded, and either nothing was sent or the message says an email may have been, in which case retrying will not send a second. The caller’s own role is read again at the moment of the change, so an owner who was demoted or removed a moment earlier is refused (403 or 404). When the server has no email service configured, the invitation is only recorded and nothing is sent.

Path parameters

workspaceId
string (uuid)
REQUIRED

The workspace.

Request body

email
string
REQUIRED

The address to invite.

max length 254

role
"owner" | "operator" | "viewer"
REQUIRED

The role the person is given when they join. An owner may invite another owner.

Responses

201 object Created
400 Error Invalid request.
401 Error Missing, malformed or unknown bearer token.
403 Error The token is valid but not permitted on this route.
404 Error No such resource.
409 Error Conflicts with existing state.
429 Error Too many for now: try again later.
503 Error A dependency this route needs is unreachable.