Get user¶
GET/
Common API · Directory Management
Get a user by ID.
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. |
userId | path | string (uuid) | Yes | User ID. |
Request samples¶
curl -X GET "https://api-<data-region>.central.sophos.com/common/v1/directory/users/<userId>" -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/directory/users/<userId>",
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/directory/users/<userId>" -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/directory/users/<userId>", 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/directory/users/<userId>", {
method: "GET",
headers: {
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
},
});
const data = await response.json();
console.log(data);
Responses¶
200 — User.¶
Response fields
idstring (uuid)requiredUser ID.
namestringrequiredUser's name.
firstNamestringUser's first name or given name.
lastNamestringUser's last name or surname.
emailstringUser's email address.
domainstringDomain name.
exchangeLoginstringUser's Exchange login.
groupsobjectAssociated groups.
Show child attributesHide child attributes
totalintegeritemsCountintegeritemsarray of objectItems must be unique.
Group reference.
Show child attributesHide child attributes
idstring (uuid)requiredGroup ID.
namestringGroup name.
displayNamestringDisplay name.
tenantobjectrequiredReference to a tenant.
Show child attributesHide child attributes
idstring (uuid)requiredTenant ID.
namestringTenant Name.
sourceobjectrequiredSource of directory information.
Show child attributesHide child attributes
typestring (enum)requiredTypes of sources of directory information. All users and groups created using this API have the source type
Must be one of:
custom. All users and groups synchronized from Active Directory, Azure Active Directory or Google Directory have the source type activeDirectory, azureActiveDirectory or googleDirectory respectively.Must be one of:
custom, activeDirectory, azureActiveDirectory, googleDirectory.createdAtstring (datetime)When the user was created.
updatedAtstring (datetime)When the user was last updated.
managerobjectManager in the directory.
Show child attributesHide child attributes
idstring (uuid)Manager ID.
namestringManager name.
Errors¶
| Status | Meaning |
|---|---|
404 | Can't find user. |
500 | Internal server error. |
All error responses share the same shape — see the error response object.
Response examples¶
200¶
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"domain": "string",
"exchangeLogin": "string",
"groups": {
"total": 0,
"itemsCount": 0,
"items": [
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"displayName": "string"
}
]
},
"tenant": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string"
},
"source": {
"type": "custom"
},
"createdAt": "string",
"updatedAt": "string",
"manager": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string"
}
}