Create device group¶
POST/
Mobile API · DeviceGroups
Create device group.
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. |
Request body¶
Content type: application/json
Request body fields
namestringrequiredThe device group name.
Must be at most 100 characters long.
Must be at most 100 characters long.
descriptionstringA description of the device group.
Must be at most 500 characters long.
Must be at most 500 characters long.
employeeCompliancePolicyIdstring (uuid)requiredID of the compliance policy for devices owned by the user.
corporateCompliancePolicyIdstring (uuid)requiredID of the compliance policy for devices owned by the organization.
iosAutoEnrollmentobjectSettings for iOS auto-enrollment in mobile device groups.
Show child attributesHide child attributes
enabledbooleanrequiredWhether this device group is assigned to iOS devices that auto-enroll with Sophos Mobile..
installSmcAppbooleanWhether the SMC app will be installed via MDM during enrollment.
Request samples¶
curl -X POST "https://api-<data-region>.central.sophos.com/mobile/v1/device-groups" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>" -H "Content-Type: application/json" -d "{
\"name\": \"My device group\",
\"employeeCompliancePolicyId\": \"5C821A6D-8CD0-41FA-BE00-920BCEE025BC\",
\"corporateCompliancePolicyId\": \"32DBD7D0-23F7-4DAF-AF4E-FEA7036D0304\"
}"
import requests
response = requests.post(
"https://api-<data-region>.central.sophos.com/mobile/v1/device-groups",
headers={
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
json={ 'name': 'My device group',
'employeeCompliancePolicyId': '5C821A6D-8CD0-41FA-BE00-920BCEE025BC',
'corporateCompliancePolicyId': '32DBD7D0-23F7-4DAF-AF4E-FEA7036D0304'},
)
print(response.json())
$headers = @{
"Authorization" = "Bearer <access-token>"
"X-Tenant-ID" = "<tenant-id>"
"Content-Type" = "application/json"
}
$body = '{
"name": "My device group",
"employeeCompliancePolicyId": "5C821A6D-8CD0-41FA-BE00-920BCEE025BC",
"corporateCompliancePolicyId": "32DBD7D0-23F7-4DAF-AF4E-FEA7036D0304"
}'
Invoke-RestMethod -Method POST -Uri "https://api-<data-region>.central.sophos.com/mobile/v1/device-groups" -Headers $headers -Body $body -ContentType "application/json"
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
req, err := http.NewRequest("POST", "https://api-<data-region>.central.sophos.com/mobile/v1/device-groups", strings.NewReader(`{
"name": "My device group",
"employeeCompliancePolicyId": "5C821A6D-8CD0-41FA-BE00-920BCEE025BC",
"corporateCompliancePolicyId": "32DBD7D0-23F7-4DAF-AF4E-FEA7036D0304"
}`))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer <access-token>")
req.Header.Set("X-Tenant-ID", "<tenant-id>")
req.Header.Set("Content-Type", "application/json")
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: "POST",
headers: {
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "My device group",
"employeeCompliancePolicyId": "5C821A6D-8CD0-41FA-BE00-920BCEE025BC",
"corporateCompliancePolicyId": "32DBD7D0-23F7-4DAF-AF4E-FEA7036D0304"
}),
});
const data = await response.json();
console.log(data);
Responses¶
201 — The new device group.¶
Response fields
idstring (uuid)requiredID of the device group.
tenantobjectrequiredTenant this resource belongs to.
Show child attributesHide child attributes
idstring (uuid)requirednamestringnamestringThe device group name.
Must be at most 100 characters long.
Must be at most 100 characters long.
descriptionstringA description of the device group.
Must be at most 500 characters long.
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.
createdByobjectPrincipal reference.
Show child attributesHide child attributes
idstring (uuid)Principal ID.
typestring (enum)requiredPrincipal type.
Must be one of:
Must be one of:
user, service, system.accountIdstring (uuid)Account ID.
accountTypestring (enum)Account type.
Must be one of:
Must be one of:
partner, tenant, organization.namestringPrincipal name or email.
updatedByobjectPrincipal reference.
Show child attributesHide child attributes
idstring (uuid)Principal ID.
typestring (enum)requiredPrincipal type.
Must be one of:
Must be one of:
user, service, system.accountIdstring (uuid)Account ID.
accountTypestring (enum)Account type.
Must be one of:
Must be one of:
partner, tenant, organization.namestringPrincipal name or email.
employeeCompliancePolicyobjectA compliance policy reference.
Show child attributesHide child attributes
idstring (uuid)requiredUnique ID of the compliance policy.
namestringThe compliance policy name.
corporateCompliancePolicyobjectA compliance policy reference.
Show child attributesHide child attributes
idstring (uuid)requiredUnique ID of the compliance policy.
namestringThe compliance policy name.
iosAutoEnrollmentobjectSettings for iOS auto-enrollment in mobile device groups.
Show child attributesHide child attributes
enabledbooleanWhether this device group is assigned to iOS devices that auto-enroll with Sophos Mobile.
installSmcAppbooleanWhether 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.
Errors¶
| Status | Meaning |
|---|---|
400 | Invalid request. |
401 | Unauthorized. |
403 | Forbidden. |
404 | Request contains no object. |
409 | Conflicting modification. |
422 | Maximum number of device groups exceeded. |
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¶
201¶
{
"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"
}
}
See the guide for a narrative walkthrough of this API.