SharePoint Rest API: Remove User by login name or User ID from SharePoint Group

This SharePoint Rest API tutorial explains, how to remove a user by Login name or user id from a SharePoint security group using Rest API.

The rest api code will work in SharePoint 2013 or SharePoint 2016. If you are new to Rest API, check out SharePoint Rest API Tutorial and Examples.

Remove User by LoginName or User ID from SharePoint Group using Rest API

We can easily remove a user from SharePoint group by login name or by user id using Rest API in SharePoint Online or SharePoint 2013/2016.

You can use removeByLoginName(‘domain\username’) or removed(10) to remove the user from the SharePoint group. Here 10 is the id of the user. Check out this article to know how to get id of the user using Rest Api.

Put the below code inside a script editor web part or content editor web part. This will be a POST Rest API call.

<script src=""></script>
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups(2544)/users/removeByLoginName(‘domain\\username’)";
url: requestUri,
type: "POST",
success: onSuccess,
error: onError
function onSuccess(data) {
alert(‘User Removed successfully’);
function onError(error) {
<input type="button" id="btnClick" value="Remove User from SharePoint Group"/>

Simillarly, if you want to remove user by id then the rest URL will be like below:

var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups(2544)/users/removebyid(10)";

Here 10 is the id of the user.

You may like following SharePoint Rest API tutorials:

Hope this will be helpful to remove a user from SharePoint group using rest api by using login name or user id in SharePoint Online/2013/2016.

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)


Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site