[comment]: # ({8703e8df-8703e8df})
# hostgroup.massremove

[comment]: # ({/8703e8df-8703e8df})

[comment]: # ({bcf1ded4-bcf1ded4})
### Description

`object hostgroup.massremove(object parameters)`

This method allows to remove related objects from multiple host groups.

::: noteclassic
This method is only available to *Admin* and *Super admin*
user types. Permissions to call the method can be revoked in user role
settings. See [User
roles](/manual/web_interface/frontend_sections/administration/user_roles)
for more information.
:::

[comment]: # ({/bcf1ded4-bcf1ded4})

[comment]: # ({0e72a68e-6b7b7475})
### Parameters

`(object)` Parameters containing the IDs of the host groups to update
and the objects that should be removed.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|--|--|------|
|**groupids**<br>(required)|string/array|IDs of the host groups to be updated.|
|hostids|string/array|Hosts to remove from all host groups.|

[comment]: # ({/0e72a68e-6b7b7475})

[comment]: # ({736f3b05-736f3b05})
### Return values

`(object)` Returns an object containing the IDs of the updated host
groups under the `groupids` property.

[comment]: # ({/736f3b05-736f3b05})

[comment]: # ({b41637d2-b41637d2})
### Examples

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({cf36d4e8-cf36d4e8})
#### Removing hosts from host groups

Remove two hosts from the given host groups.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "hostgroup.massremove",
    "params": {
        "groupids": [
            "5",
            "6"
        ],
        "hostids": [
            "30050",
            "30001"
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "groupids": [
            "5",
            "6"
        ]
    },
    "id": 1
}
```

[comment]: # ({/cf36d4e8-cf36d4e8})

[comment]: # ({3700b99d-3700b99d})
### Source

CHostGroup::massRemove() in
*ui/include/classes/api/services/CHostGroup.php*.

[comment]: # ({/3700b99d-3700b99d})
