[comment]: # ({2a0a5084-2a0a5084})
# host.massremove

[comment]: # ({/2a0a5084-2a0a5084})

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

`object host.massremove(object parameters)`

This method allows to remove related objects from multiple hosts.

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

[comment]: # ({b2b45ff4-689d39a3})
### Parameters

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

|Parameter|Type|Description|
|---------|----|-----------|
|**hostids**<br>(required)|string/array|IDs of the hosts to be updated.|
|groupids|string/array|Host groups to remove the given hosts from.|
|interfaces|object/array|Host interfaces to remove from the given hosts.<br><br>The host interface object must have the `ip`, `dns` and `port` properties defined.|
|macros|string/array|User macros to delete from the given hosts.|
|templateids|string/array|Templates to unlink from the given hosts.|
|templateids\_clear|string/array|Templates to unlink and clear from the given hosts.|

[comment]: # ({/b2b45ff4-689d39a3})

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

`(object)` Returns an object containing the IDs of the updated hosts
under the `hostids` property.

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

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

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

[comment]: # ({8c635a7b-8c635a7b})
#### Unlinking templates

Unlink a template from two hosts and delete all of the templated
entities.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "host.massremove",
    "params": {
        "hostids": ["69665", "69666"],
        "templateids_clear": "325"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "hostids": [
            "69665",
            "69666"
        ]
    },
    "id": 1
}
```

[comment]: # ({/8c635a7b-8c635a7b})

[comment]: # ({abd9a8d3-abd9a8d3})
### See also

-   [host.update](update)
-   [User
    macro](/manual/api/reference/usermacro/object#hosttemplate_level_macro)
-   [Host
    interface](/manual/api/reference/hostinterface/object#host_interface)

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

[comment]: # ({d8200bce-d8200bce})
### Source

CHost::massRemove() in
*frontends/php/include/classes/api/services/CHost.php*.

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