Skip to content

List device groups

GET/device-groups

Mobile API · DeviceGroups

Get list of device groups.

Required permissionmobile.device-group:read

Parameters

Name In Type Required Description
X-Tenant-ID header string (uuid) Yes Tenant ID.
fields query array of string No The fields to return in a partial response.
view query string No Type of view to be returned in response.
Must be one of: basic, summary, full.
ids query array of string (uuid) No List of IDs.
sort query array of string No Defines how to sort the data.
Each item must match the pattern (^[^:]+$)|(^[^:]+:(asc|desc)$).
page query integer No The page number to fetch, starting with 1.
pageSize query integer No The size of the page requested.
pageTotal query boolean No Whether the number of pages should be calculated and returned in the response.
search query string No Term to search for in the specified search fields.
Must be at most 200 characters long.
searchFields query array of string No List of fields to search in. Defaults to all applicable fields.
Each item must be one of: name.

Request samples

curl -X GET "https://api-<data-region>.central.sophos.com/mobile/v1/device-groups" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>"

import requests

response = requests.get(
    "https://api-<data-region>.central.sophos.com/mobile/v1/device-groups",
    headers={
        "Authorization": "Bearer <access-token>",
        "X-Tenant-ID": "<tenant-id>",
    },
)
print(response.json())

$headers = @{
    "Authorization" = "Bearer <access-token>"
    "X-Tenant-ID" = "<tenant-id>"
}
Invoke-RestMethod -Method GET -Uri "https://api-<data-region>.central.sophos.com/mobile/v1/device-groups" -Headers $headers

package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    req, err := http.NewRequest("GET", "https://api-<data-region>.central.sophos.com/mobile/v1/device-groups", nil)
    if err != nil {
        panic(err)
    }
    req.Header.Set("Authorization", "Bearer <access-token>")
    req.Header.Set("X-Tenant-ID", "<tenant-id>")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}

const response = await fetch("https://api-<data-region>.central.sophos.com/mobile/v1/device-groups", {
  method: "GET",
  headers: {
    "Authorization": "Bearer <access-token>",
    "X-Tenant-ID": "<tenant-id>",
  },
});
const data = await response.json();
console.log(data);

Responses

200 — List of device groups.

Response fields

itemsarray of objectrequired
List of device groups.
Mobile device group response.
Show child attributesHide child attributes
idstring (uuid)required
ID of the device group.
tenantobjectrequired
Tenant this resource belongs to.
Show child attributesHide child attributes
idstring (uuid)required
namestring
namestring
The device group name.
Must be at most 100 characters long.
descriptionstring
A description of the device group.
Must be at most 500 characters long.
createdAtstring (date-time)
The time when the device group was created.
updatedAtstring (date-time)
The last time when the device group was updated.
createdByobject
Principal reference.
Show child attributesHide child attributes
idstring (uuid)
Principal ID.
typestring (enum)required
Principal type.
Must be one of: user, service, system.
accountIdstring (uuid)
Account ID.
accountTypestring (enum)
Account type.
Must be one of: partner, tenant, organization.
namestring
Principal name or email.
updatedByobject
Principal reference.
Show child attributesHide child attributes
idstring (uuid)
Principal ID.
typestring (enum)required
Principal type.
Must be one of: user, service, system.
accountIdstring (uuid)
Account ID.
accountTypestring (enum)
Account type.
Must be one of: partner, tenant, organization.
namestring
Principal name or email.
employeeCompliancePolicyobject
A compliance policy reference.
Show child attributesHide child attributes
idstring (uuid)required
Unique ID of the compliance policy.
namestring
The compliance policy name.
corporateCompliancePolicyobject
A compliance policy reference.
Show child attributesHide child attributes
idstring (uuid)required
Unique ID of the compliance policy.
namestring
The compliance policy name.
iosAutoEnrollmentobject
Settings for iOS auto-enrollment in mobile device groups.
Show child attributesHide child attributes
enabledboolean
Whether this device group is assigned to iOS devices that auto-enroll with Sophos Mobile.
installSmcAppboolean
Whether the SMC app will be installed via MDM during enrollment.
urlstring (url)
The URL one must enter in Apple Configurator when configuring devices for auto-enrollment.
pagesobjectrequired
Show child attributesHide child attributes
currentintegerrequired
The 1-based page number being returned.
sizeintegerrequired
The size of the page being returned.
totalinteger
(Optional) The total number of pages that exist, if pageTotal=true in the request.
itemsinteger
(Optional) The total number of items across all pages.
maxSizeintegerrequired
The maximum page size that can be requested.

Errors

Status Meaning
400 Invalid request.
401 Unauthorized.
403 Forbidden.
429 Too many requests. See Retry-After header.
500 Internal server error.

All error responses share the same shape — see the error response object.

Response examples

200

{
  "items": [
    {
      "id": "c9c9b03c-5cf7-4fe1-93bb-246afc9044d2",
      "tenant": {
        "id": "b8a75c7d-7492-4009-9f95-8c815551dc55",
        "name": "The name of the tenant"
      },
      "name": "My device group",
      "employeeCompliancePolicy": {
        "id": "5C821A6D-8CD0-41FA-BE00-920BCEE025BC",
        "name": "The name of the compliance policy"
      },
      "corporateCompliancePolicy": {
        "id": "5C821A6D-8CD0-41FA-BE00-920BCEE025BC",
        "name": "The name of the compliance policy"
      }
    },
    {
      "id": "c9c9b03c-5cf7-4fe1-93bb-246afc9044d2",
      "tenant": {
        "id": "b8a75c7d-7492-4009-9f95-8c815551dc55",
        "name": "The name of the tenant"
      },
      "name": "My device group",
      "employeeCompliancePolicy": {
        "id": "5C821A6D-8CD0-41FA-BE00-920BCEE025BC",
        "name": "The name of the compliance policy"
      },
      "corporateCompliancePolicy": {
        "id": "5C821A6D-8CD0-41FA-BE00-920BCEE025BC",
        "name": "The name of the compliance policy"
      },
      "iosAutoEnrollment": {
        "enabled": true,
        "installSmcApp": true,
        "url": "https://smc-device-if-cloudstation-us-east-1.prod.hydra.sophos.com/client-api/auto-enrollment/10815/4ff9ec17-aaaa-bbbb-cccc-32f193067e8f"
      }
    }
  ],
  "pages": {
    "current": 1,
    "size": 50,
    "maxSize": 500
  }
}

See the guide for a narrative walkthrough of this API.