Remove a user from a group
Remove a represented user from one group, if they still belong to it. Their other memberships stay.
/api/v1/groups/:groupId/users/:userIdconst response = await fetch("https://api.smallworld.sh/api/v1/groups/team_42/users/customer_123", {
method: "DELETE",
headers: { Authorization: `Bearer ${apiKey}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();
Use your server-side apiKey. Replace the example IDs.
Path parameters#
groupIdstringrequiredYour application's group ID, URL-encoded. At most 512 characters, with no surrounding whitespace or null bytes.
userIdstringrequiredYour application's user ID, URL-encoded. At most 512 characters, with no surrounding whitespace or null bytes. Encode the IDs
.and..as%2Eand%2E%2E: curl sends these as written, but JavaScript'sfetchremoves them even when encoded.
Responses#
Returns id, nullable email, groupIds, and ISO 8601 createdAt and updatedAt timestamps. The ID is your application's identifier; groupIds lists your IDs for the user's current groups, ordered by ID, and is empty when they belong to none.
{
"id": "customer_123",
"email": "customer@example.com",
"groupIds": [],
"createdAt": "2026-10-10T12:00:00.000Z",
"updatedAt": "2026-10-10T12:00:00.000Z"
}
More about this endpoint
Only this membership is removed. The user stays, with their other groups, their own connections, and their history.
The user's sessions that acted for this group are closed for good, with closedReason group_membership_removed. A running command is stopped at once and ends interrupted with errorCode session_closed. A command waiting for approval ends the same way, and its pending tool call ends interrupted with errorCode session_closed. Further commands in these sessions return session_closed. Their executions, tool calls, and outputs stay readable. Adding the user to the group again does not reopen them; start a new session. The user's sessions for other groups are unaffected.
When the user is not in this group, nothing changes and the response shows their current groupIds. A delayed removal never undoes a newer move.
The Playground user can't leave the Playground Group.