Create new admin¶
POST/
Partner API · Partner Admins
Create a new partner administrator.
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-Partner-ID | header | string (uuid) | Yes | Partner ID. |
Request body¶
Content type: application/json
Request body fields
usernamestring (email)requiredAdministrator username (email).
profileobjectrequiredProfile information for partner administrator.
Show child attributesHide child attributes
namestringrequiredFull name.
firstNamestringrequiredFirst name.
lastNamestringrequiredLast name.
phonestringPhone number.
mobilestringMobile phone number.
faxstringFax number.
roleAssignmentsarray of objectRole assignments.
New role assignment request.
Show child attributesHide child attributes
roleIdstring (uuid)requiredRole ID.
scopeobjectrequiredRole assignment scope.
Show child attributesHide child attributes
typestringrequiredRole assignment scope type.
Must be one of:
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/partner/v1/admins" -H "Authorization: Bearer <access-token>" -H "X-Partner-ID: <partner-id>" -H "Content-Type: application/json" -d "{
\"username\": \"john.smith@example.com\",
\"profile\": {
\"name\": \"John J. Smith\",
\"firstName\": \"John\",
\"lastName\": \"Smith\"
},
\"roleAssignments\": [
{
\"id\": \"0b8f2624-b054-45e0-923e-6527d9054342\",
\"roleId\": \"70617274-6e65-7273-7570-657261646d69\",
\"scope\": {
\"type\": \"self\"
}
}
]
}"
import requests
response = requests.post(
"https://api.central.sophos.com/partner/v1/admins",
headers={
"Authorization": "Bearer <access-token>",
"X-Partner-ID": "<partner-id>",
"Content-Type": "application/json",
},
json={ 'username': 'john.smith@example.com',
'profile': { 'name': 'John J. Smith',
'firstName': 'John',
'lastName': 'Smith'},
'roleAssignments': [ { 'id': '0b8f2624-b054-45e0-923e-6527d9054342',
'roleId': '70617274-6e65-7273-7570-657261646d69',
'scope': {'type': 'self'}}]},
)
print(response.json())
$headers = @{
"Authorization" = "Bearer <access-token>"
"X-Partner-ID" = "<partner-id>"
"Content-Type" = "application/json"
}
$body = '{
"username": "john.smith@example.com",
"profile": {
"name": "John J. Smith",
"firstName": "John",
"lastName": "Smith"
},
"roleAssignments": [
{
"id": "0b8f2624-b054-45e0-923e-6527d9054342",
"roleId": "70617274-6e65-7273-7570-657261646d69",
"scope": {
"type": "self"
}
}
]
}'
Invoke-RestMethod -Method POST -Uri "https://api.central.sophos.com/partner/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/partner/v1/admins", strings.NewReader(`{
"username": "john.smith@example.com",
"profile": {
"name": "John J. Smith",
"firstName": "John",
"lastName": "Smith"
},
"roleAssignments": [
{
"id": "0b8f2624-b054-45e0-923e-6527d9054342",
"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-Partner-ID", "<partner-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/partner/v1/admins", {
method: "POST",
headers: {
"Authorization": "Bearer <access-token>",
"X-Partner-ID": "<partner-id>",
"Content-Type": "application/json",
},
body: JSON.stringify({
"username": "john.smith@example.com",
"profile": {
"name": "John J. Smith",
"firstName": "John",
"lastName": "Smith"
},
"roleAssignments": [
{
"id": "0b8f2624-b054-45e0-923e-6527d9054342",
"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)requiredAdministrator ID.
usernamestring (email)requiredAdministrator username (email).
profileobjectrequiredProfile information for partner administrator.
Show child attributesHide child attributes
namestringrequiredFull name.
firstNamestringrequiredFirst name.
lastNamestringrequiredLast name.
phonestringPhone number.
mobilestringMobile phone number.
faxstringFax number.
activebooleanrequiredWhether the administrator is active.
primarybooleanrequiredWhether this is the primary administrator for the account.
roleAssignmentsarray of objectrequiredAdministrator's role assignments.
Role assignment.
Show child attributesHide child attributes
idstring (uuid)requiredRole assignment ID.
roleIdstring (uuid)requiredRole ID.
roleNamestringRole name.
scopeobjectrequiredRole assignment scope.
Show child attributesHide child attributes
typestringrequiredRole assignment scope type.
Must be one of:
Must be one of:
tenant, allManagedTenants, self, tenantGroup.idstring (uuid)Tenant ID. Optional or not present when
type is allManagedTenants or self.namestringTenant 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.