foliot docs

API reference / Workspaces / Change a member's role

Change a member's role

PUT/workspaces/{workspaceId}/members/{userId}/role

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

The only operation that changes a member’s role: a person joins with the role the invitation named, and the Clerk webhook never adds anyone or changes a role. An owner of the workspace, or an operator token (which is also how an operator makes a member the owner of a workspace that has none). The new role applies to the member’s very next request. 404 if the person is not a member of this workspace: this never adds anyone. Setting the role the member already has changes nothing and answers 200. 409 if it would demote the workspace’s only owner, whoever asks: make someone else an owner first. An owner may demote themselves once another owner exists. 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) and changes nothing.

Path parameters

workspaceId
string (uuid)
REQUIRED

The workspace.

userId
string (uuid)
REQUIRED

Foliot's id for the member (userId in the member list), not their Clerk id.

Request body

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

The role the member is to have.

Responses

200 object OK
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.
503 Error A dependency this route needs is unreachable.