Skip to content

Who am I?

GET/

Who-am-I API · whoami

Returns information about the caller.

Request samples

curl -X GET "https://api.central.sophos.com/whoami/v1/" -H "Authorization: Bearer <access-token>"

import requests

response = requests.get(
    "https://api.central.sophos.com/whoami/v1/",
    headers={
        "Authorization": "Bearer <access-token>",
    },
)
print(response.json())

$headers = @{
    "Authorization" = "Bearer <access-token>"
}
Invoke-RestMethod -Method GET -Uri "https://api.central.sophos.com/whoami/v1/" -Headers $headers

package main

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

func main() {
    req, err := http.NewRequest("GET", "https://api.central.sophos.com/whoami/v1/", nil)
    if err != nil {
        panic(err)
    }
    req.Header.Set("Authorization", "Bearer <access-token>")

    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.central.sophos.com/whoami/v1/", {
  method: "GET",
  headers: {
    "Authorization": "Bearer <access-token>",
  },
});
const data = await response.json();
console.log(data);

Responses

200 — Information about the caller.

Response fields

idstring (uuid)required
ID of the caller.
idTypestring
The type of the ID of the caller.
Must be one of: partner, organization, distributor, tenant.
apiHostsobject
API hosts that are available to the caller.
Show child attributesHide child attributes
globalstring (uri)
dataRegionstring (uri)

Response examples

200

{
  "id": "00000000-0000-0000-0000-000000000000",
  "idType": "partner",
  "apiHosts": {
    "global": "https://example.com",
    "dataRegion": "https://example.com"
  }
}