Skip to main content
Leave Space
Removes the acting user’s membership (the token’s user, or the user a service key names in actingUserId) from a space and from its child spaces, and ends their membership of those spaces’ chats. A ban in a child space is kept: leaving does not clear it. The space’s owner (its userId: the creator of a top-level space, the root space’s creator for a sub-space) can’t leave: they stay an admin of the space for as long as it exists.

Path Parameters

string
required
UUID of the space to leave.

Query Parameters

string
Required with a service key: the user this request acts as. The request has exactly that user’s permissions, so it is refused unless they are an active member of the space, and it is recorded as theirs. A user token always acts as its own user and must not send it (400 space/acting-user-not-allowed).

Response

204 No Content on success, with no body. To read the user’s permissions in the space now, as a non-member, fetch the space again (Fetch Space): its memberPermissions describe them, for as long as the user can still see the space.

Errors

Returned when spaceId isn’t a valid UUID. Checked before sign-in, permissions and the endpoint’s other checks.
A service key sent no actingUserId.
actingUserId is not a user id.
A user token sent actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
The request carried a body. A DELETE takes no body: send actingUserId in the query string.
Returned when a service key names an actingUserId that isn’t a user in this project.
The user is not an active member of the space (no membership, or one that is pending, banned or rejected), including when a service key acts for them.
The user is the last admin of this space:
or of one of its child spaces, named by spaceId:
See also: useLeaveSpace