Skip to content

List all roles

GET/admins/{adminId}/role-assignments

Common API · tenant-access

Get the list of role assignments for given admin.

Required permissionassignment:read

Parameters

Name In Type Required Description
X-Tenant-ID header string (uuid) Yes Tenant ID.
adminId path string (uuid) Yes Admin ID.

Request samples

curl -X GET "https://api-<data-region>.central.sophos.com/common/v1/admins/<adminId>/role-assignments" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>"

import requests

response = requests.get(
    "https://api-<data-region>.central.sophos.com/common/v1/admins/<adminId>/role-assignments",
    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/common/v1/admins/<adminId>/role-assignments" -Headers $headers

package main

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

func main() {
    req, err := http.NewRequest("GET", "https://api-<data-region>.central.sophos.com/common/v1/admins/<adminId>/role-assignments", 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/common/v1/admins/<adminId>/role-assignments", {
  method: "GET",
  headers: {
    "Authorization": "Bearer <access-token>",
    "X-Tenant-ID": "<tenant-id>",
  },
});
const data = await response.json();
console.log(data);

Responses

200 — List of role assignments for an admin.

Response fields

itemsarray of objectrequired
List of role assignments.
Items must be unique.
Role assignment.
Show child attributesHide child attributes
idstring (uuid)required
Role assignment ID.
roleIdstring (uuid)required
Role UUID.

Errors

Status Meaning
500 Internal server error.

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

Response examples

200

{
  "items": [
    {
      "id": "4bcb8ee6-720b-40c7-b748-716a3c47c185",
      "roleId": "c83c9481-f63c-4eb8-8793-e81eb9d66ef4"
    },
    {
      "id": "c4af6827-06c1-46d3-a4d3-cc937ff02e46",
      "roleId": "4b357587-a78b-4883-aff8-99bdd308b7b6"
    },
    {
      "id": "3d469dbb-93c5-45e3-bbcf-8881e56f18c4",
      "roleId": "ec813884-2570-444b-a1fc-956940a69ce0"
    }
  ]
}