# How to stop sharing using API

**URL:** https://community.passbolt.com/t/how-to-stop-sharing-using-api/3397
**Category:** API & Customization issues
**Created:** [December 30, 2020, 3:57pm UTC](https://community.passbolt.com/t/how-to-stop-sharing-using-api/3397 "2020-12-30T15:57:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kyxyes](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kyxyes](https://community.passbolt.com/u/kyxyes)
#### Post date: [December 30, 2020, 3:57pm UTC](https://community.passbolt.com/t/how-to-stop-sharing-using-api/3397/1 "2020-12-30T15:57:28Z")

</div>

Hi  
Currently I want to use API to stop sharing a resource to a group like on this screenshot: click the cross button to remove a group from current resource.

 ![Screen Shot 2020-12-30 at 10.49.07 AM](https://canada1.discourse-cdn.com/flex031/uploads/passbolt/original/1X/f176b6e425d461fa8a519ed2ed07452ccadf211d.png)  
It might be related to this issue: [How can I delete a permission using the API?](https://community.passbolt.com/t/how-can-i-delete-a-permission-using-the-api/2399)  
I saw the reply is [push the updated permissions using the share endpoint](https://community.passbolt.com/t/how-can-i-delete-a-permission-using-the-api/2399/5)  
So How could I implement that since I can’t find this on document, the only example is how to simulate share a resource to group, could you maybe instruct me how to remove sharing?  
Thank you!

---

<div class="post-metadata">

### Author: ![remy](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/remy/32/17_2.png) [@remy](https://community.passbolt.com/u/remy)
#### Post date: [December 31, 2020, 5:20am UTC](https://community.passbolt.com/t/how-to-stop-sharing-using-api/3397/3 "2020-12-31T05:20:16Z")

</div>

@kyxyes in order to remove a permission you need to call the share endpoint. You basically resend the permission you want to delete with the `"delete": true` flag. For example:

(_Edited from POST to PUT)_

```auto
PUT /share/resource/<uuid_of_resource>.json?api-version=2

```

```auto
{
   "permissions":[
      {
         "id":"40e26b09-8ed0-5d15-9b0c-d595bbb3cfe4",
         "aco":"Resource",
         "aco_foreign_key":"690b6e40-f371-579c-b0c6-86e8ef383adc",
         "aro":"User",
         "aro_foreign_key":"e97b14ba-8957-57c9-a357-f78a6e1e1a46",
         "type":7,
         "delete":true
      }
   ]
}

```

---

<div class="post-metadata">

### Author: ![kyxyes](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kyxyes](https://community.passbolt.com/u/kyxyes)
#### Post date: [January 5, 2021, 3:08am UTC](https://community.passbolt.com/t/how-to-stop-sharing-using-api/3397/4 "2021-01-05T03:08:54Z")

</div>

@remy Hi Thank you so much!  
I tried `POST` but this method does not work for me, it returns 404 error.  
But `PUT` method with the API url and the flag you gave me can successfully remove the shared resource.
