Skip to content

Create a new admin

POST/admins

Organization API · Organization Admins

Create a new organization administrator.

Required permissionaccount_management:write

Parameters

Name In Type Required Description
X-Organization-ID header string (uuid) Yes Organization ID.

Request body

Content type: application/json

Request body fields

usernamestring (email)required
Administrator username (email).
profileobjectrequired
Profile information for organization administrator.
Show child attributesHide child attributes
namestringrequired
Full name.
firstNamestringrequired
First name.
lastNamestringrequired
Last name.
phonestring
Phone number.
mobilestring
Mobile phone number.
faxstring
Fax number.
roleAssignmentsarray of object
Role assignments.
New role assignment request.
Show child attributesHide child attributes
roleIdstring (uuid)required
Role ID.
scopeobjectrequired
Role assignment scope.
Show child attributesHide child attributes
typestringrequired
Role assignment scope type.
Must be one of: tenant, allManagedTenants, self, tenantGroup.
idstring (uuid)
Tenant ID. Optional or not present when type is allManagedTenants or self.

Request samples

curl -X POST "https://api.central.sophos.com/organization/v1/admins" -H "Authorization: Bearer <access-token>" -H "X-Organization-ID: <organization-id>" -H "Content-Type: application/json" -d "{
  \"username\": \"john.smith@example.com\",
  \"profile\": {
    \"name\": \"John J. Smith\",
    \"firstName\": \"John\",
    \"lastName\": \"Smith\"
  },
  \"roleAssignments\": [
    {
      \"roleId\": \"70617274-6e65-7273-7570-657261646d69\",
      \"scope\": {
        \"type\": \"self\"
      }
    }
  ]
}"

import requests

response = requests.post(
    "https://api.central.sophos.com/organization/v1/admins",
    headers={
        "Authorization": "Bearer <access-token>",
        "X-Organization-ID": "<organization-id>",
        "Content-Type": "application/json",
    },
    json={   'username': 'john.smith@example.com',
    'profile': {   'name': 'John J. Smith',
                   'firstName': 'John',
                   'lastName': 'Smith'},
    'roleAssignments': [   {   'roleId': '70617274-6e65-7273-7570-657261646d69',
                               'scope': {'type': 'self'}}]},
)
print(response.json())

$headers = @{
    "Authorization" = "Bearer <access-token>"
    "X-Organization-ID" = "<organization-id>"
    "Content-Type" = "application/json"
}
$body = '{
  "username": "john.smith@example.com",
  "profile": {
    "name": "John J. Smith",
    "firstName": "John",
    "lastName": "Smith"
  },
  "roleAssignments": [
    {
      "roleId": "70617274-6e65-7273-7570-657261646d69",
      "scope": {
        "type": "self"
      }
    }
  ]
}'
Invoke-RestMethod -Method POST -Uri "https://api.central.sophos.com/organization/v1/admins" -Headers $headers -Body $body -ContentType "application/json"

package main

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

func main() {
    req, err := http.NewRequest("POST", "https://api.central.sophos.com/organization/v1/admins", strings.NewReader(`{
  "username": "john.smith@example.com",
  "profile": {
    "name": "John J. Smith",
    "firstName": "John",
    "lastName": "Smith"
  },
  "roleAssignments": [
    {
      "roleId": "70617274-6e65-7273-7570-657261646d69",
      "scope": {
        "type": "self"
      }
    }
  ]
}`))
    if err != nil {
        panic(err)
    }
    req.Header.Set("Authorization", "Bearer <access-token>")
    req.Header.Set("X-Organization-ID", "<organization-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.central.sophos.com/organization/v1/admins", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <access-token>",
    "X-Organization-ID": "<organization-id>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "username": "john.smith@example.com",
  "profile": {
    "name": "John J. Smith",
    "firstName": "John",
    "lastName": "Smith"
  },
  "roleAssignments": [
    {
      "roleId": "70617274-6e65-7273-7570-657261646d69",
      "scope": {
        "type": "self"
      }
    }
  ]
}),
});
const data = await response.json();
console.log(data);

Responses

201 — Requested admin created.

Response fields

idstring (uuid)required
Administrator ID.
usernamestring (email)required
Administrator username (email).
profileobjectrequired
Profile information for organization administrator.
Show child attributesHide child attributes
namestringrequired
Full name.
firstNamestringrequired
First name.
lastNamestringrequired
Last name.
phonestring
Phone number.
mobilestring
Mobile phone number.
faxstring
Fax number.
activebooleanrequired
Whether the administrator is active.
primarybooleanrequired
Whether this is the primary administrator for the account.
roleAssignmentsarray of objectrequired
Administrator's role assignments.
Role assignment.
Show child attributesHide child attributes
idstring (uuid)required
Role assignment ID.
roleIdstring (uuid)required
Role ID.
roleNamestring
Role name.
scopeobjectrequired
Role assignment scope.
Show child attributesHide child attributes
typestringrequired
Role assignment scope type.
Must be one of: tenant, allManagedTenants, self, tenantGroup.
idstring (uuid)
Tenant ID. Optional or not present when type is allManagedTenants or self.
namestring
Tenant name. Optional or not present when type is allManagedTenants or self.

Errors

Status Meaning
400 Bad request.
409 Email address already in use.
500 Unexpected error.

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

Response examples

201

{
  "id": "00000000-0000-0000-0000-000000000000",
  "username": "user@example.com",
  "profile": {
    "name": "string",
    "firstName": "string",
    "lastName": "string",
    "phone": "string",
    "mobile": "string",
    "fax": "string"
  },
  "active": true,
  "primary": false,
  "roleAssignments": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "roleId": "00000000-0000-0000-0000-000000000000",
      "roleName": "string",
      "scope": {
        "type": "tenant",
        "id": "00000000-0000-0000-0000-000000000000",
        "name": "string"
      }
    }
  ]
}

See the guide for a narrative walkthrough of this API.