Remove members from Groups and Orgs via API
To remove members from Groups and Organizations programmatically, you can use the Snyk API v1 and the Snyk REST API as explained in the steps that follow.
Note: The following API calls cannot be issued to remove Service Accounts and the API calls are for human user accounts only.
Remove Organization memberships
Step 1: Get a list of Organization members
Request: GET https://snyk.io/api/v1/org/{orgId}/members
API documentation: https://snyk.docs.apiary.io/#reference/organizations/members-in-organization/list-members
This call returns an array of all non-admin members of the Organization. Save the id
of each user who needs to be removed from the Organization.
Step 2: Remove a member from an Organization
Request: DELETE https://snyk.io/api/v1/org/{orgId}/members/update/{userId}
API documentation: https://snyk.docs.apiary.io/#reference/organizations/manage-roles-in-organization/remove-a-member-from-the-organization
For each user, call the endpoint to remove that member from the Organization using the user id you collected previously.
For a successful request the response is 200 OK
.
Your can verify the removal of membership on the Org members page.
Remove Group memberships
Step 1: Get a list of Group members
Request: GET https://api.snyk.io/api/v1/group/groupId/members
API documentation: https://snyk.docs.apiary.io/#reference/groups/list-members-in-a-group/list-all-members-in-a-group
This call returns an array of all members of the Group. Save the id
of each user who needs to be removed from the Group.
Step 2: Remove a member from a Group
Request: PATCH https://api.snyk.io/rest/groups/{group_id}/users/{id}?version=2023-01-30~beta
Body:
{
"data": {
"attributes": {
"membership": null
},
"id": "<user-id>",
"type": "user"
}
}
API documentation: https://apidocs.snyk.io/?version=2023-01-30%7Ebeta#patch-/groups/-group_id-/users/-id-
For each user, call the endpoint to remove that member from the Group using the user id you collected previously.
For a successful request the response is 200 OK
.
Your can verify the removal of membership on the Group members page.
Delete Group Members
When an SSO connection is associated with only one Group, the following call can completely delete a Group Member from the System. This delete action also complies with the GDPR (General Data Protection Regulation) requirements.
Request: DELETE https://api.snyk.io/rest/groups/{group_id}/sso_connections/{sso_id}/users/{user_id}?version=2023-01-30~beta
API documentation: https://apidocs.snyk.io/?version=2023-01-30%7Ebeta#delete-/groups/-group_id-/sso_connections/-sso_id-/users/-user_id-
You can find the {sso_id}
on the Snyk Web UI; navigate to Group >Settings >SSO >Step 3. Alternatively reach out to your Account team for assistance.

For a successful request the response is 200 OK
.
Your can verify the deletion by using the following request;
GET https://api.snyk.io/api/v1/user/userId
Last updated
Was this helpful?