[comment]: # ({ce8d2bd2-ce8d2bd2})
# usergroup.get

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

[comment]: # ({31fb9be6-ef79b8a9})
### Description

`integer/array usergroup.get(object parameters)`

The method allows to retrieve user groups according to the given
parameters.

::: noteclassic
This method is available to users of any type. Permissions
to call the method can be revoked in user role settings. See [User
roles](/manual/web_interface/frontend_sections/users/user_roles)
for more information.
:::

[comment]: # ({/31fb9be6-ef79b8a9})

[comment]: # ({5591bd09-4be9c06e})
### Parameters

`(object)` Parameters defining the desired output.

The method supports the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|mfaids|ID/array|Return only user groups with the given MFA methods.<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *supported* for *Super admin* type users|
|mfa_status|integer|Return only user groups with the given MFA status.<br><br>Refer to the [user group page](object#user-group) for a list of supported statuses.|
|status|integer|Return only user groups with the given status.<br><br>Refer to the [user group page](object#user-group) for a list of supported statuses.|
|userids|ID/array|Return only user groups that contain the given users.|
|usrgrpids|ID/array|Return only user groups with the given IDs.|
|selectTagFilters|query|Return user group tag-based permissions in the [`tag_filters`](/manual/api/reference/usergroup/object#tag-based-permission) property.|
|selectUsers|query|Return the users from the user group in the [`users`](/manual/api/reference/user/object#user) property.<br><br>See [`user.get`](/manual/api/reference/user/get) for restrictions based on user type.|
|selectHostGroupRights|query|Return user group host group [permissions](/manual/api/reference/usergroup/object#permission) in the `hostgroup_rights` property.<br><br>Refer to the [user group page](object#permission) for a list of access levels to host groups.|
|selectTemplateGroupRights|query|Return user group template group [permissions](/manual/api/reference/usergroup/object#permission) in the `templategroup_rights` property.<br><br>Refer to the [user group page](object#permission) for a list of access levels to template groups.|
|limitSelects|integer|Limits the number of records returned by subselects.|
|output|query|[User group object](/manual/api/reference/usergroup/object) properties to be returned.<br><br>*Admin* and *User* type users may retrieve only the following properties: `usrgrpid`, `name`, `gui_access`, `users_status`, `debug_mode`, `mfa_status`.<br><br>Default: `extend`.|
|sortfield|string/array|Sort the result by the given properties.<br><br>Possible values: `usrgrpid`, `name`.|
|countOutput|boolean|These parameters are described in the [reference commentary](/manual/api/reference_commentary#common-get-method-parameters).|
|editable|boolean|^|
|excludeSearch|boolean|^|
|filter|object|^|
|limit|integer|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/5591bd09-4be9c06e})

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

`(integer/array)` Returns either:

-   an array of objects;
-   the count of retrieved objects, if the `countOutput` parameter has
    been used.

[comment]: # ({/7223bab1-7223bab1})

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

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

[comment]: # ({e685bea9-62cd5d8e})
#### Retrieving enabled user groups

Retrieve all enabled user groups.

[Request](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "usergroup.get",
    "params": {
        "output": "extend",
        "status": 0
    },
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "usrgrpid": "7",
            "name": "Zabbix administrators",
            "gui_access": "0",
            "users_status": "0",
            "debug_mode": "1",
            "userdirectoryid": "0",
            "mfa_status": "0",
            "mfaid": "0"
        },
        {
            "usrgrpid": "8",
            "name": "Guests",
            "gui_access": "0",
            "users_status": "0",
            "debug_mode": "0",
            "userdirectoryid": "0",
            "mfa_status": "0",
            "mfaid": "0"
        },
        {
            "usrgrpid": "11",
            "name": "Enabled debug mode",
            "gui_access": "0",
            "users_status": "0",
            "debug_mode": "1",
            "userdirectoryid": "0",
            "mfa_status": "0",
            "mfaid": "0"
        },
        {
            "usrgrpid": "12",
            "name": "No access to the frontend",
            "gui_access": "2",
            "users_status": "0",
            "debug_mode": "0",
            "userdirectoryid": "0",
            "mfa_status": "0",
            "mfaid": "0"
        },
        {
            "usrgrpid": "14",
            "name": "Read only",
            "gui_access": "0",
            "users_status": "0",
            "debug_mode": "0",
            "userdirectoryid": "0",
            "mfa_status": "0",
            "mfaid": "0"
        },
        {
            "usrgrpid": "18",
            "name": "Deny",
            "gui_access": "0",
            "users_status": "0",
            "debug_mode": "0",
            "userdirectoryid": "0",
            "mfa_status": "0",
            "mfaid": "0"
        }
    ],
    "id": 1
}
```

[comment]: # ({/e685bea9-62cd5d8e})

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

-   [User](/manual/api/reference/user/object#user)

[comment]: # ({/039ccba1-039ccba1})

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

CUserGroup::get() in *ui/include/classes/api/services/CUserGroup.php*.

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