Skip to content

Delete role by ID

DELETE/roles/{roleId}

Partner API · Partner role management

Delete a partner role by ID.

Required permissionpartner-role:delete

Parameters

Name In Type Required Description
X-Partner-ID header string (uuid) Yes Partner ID.
roleId path string (uuid) Yes Role ID.

Request samples

curl -X DELETE "https://api.central.sophos.com/partner/v1/roles/<roleId>" -H "Authorization: Bearer <access-token>" -H "X-Partner-ID: <partner-id>"

import requests

response = requests.delete(
    "https://api.central.sophos.com/partner/v1/roles/<roleId>",
    headers={
        "Authorization": "Bearer <access-token>",
        "X-Partner-ID": "<partner-id>",
    },
)
print(response.json())

$headers = @{
    "Authorization" = "Bearer <access-token>"
    "X-Partner-ID" = "<partner-id>"
}
Invoke-RestMethod -Method DELETE -Uri "https://api.central.sophos.com/partner/v1/roles/<roleId>" -Headers $headers

package main

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

func main() {
    req, err := http.NewRequest("DELETE", "https://api.central.sophos.com/partner/v1/roles/<roleId>", nil)
    if err != nil {
        panic(err)
    }
    req.Header.Set("Authorization", "Bearer <access-token>")
    req.Header.Set("X-Partner-ID", "<partner-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.central.sophos.com/partner/v1/roles/<roleId>", {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer <access-token>",
    "X-Partner-ID": "<partner-id>",
  },
});
const data = await response.json();
console.log(data);

Responses

200 — Requested role deleted.

Response fields

deletedboolean

Errors

Status Meaning
409 You can't delete a role assigned to an admin.
500 Unexpected error.

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

Response examples

200

{
  "deleted": true
}

See the guide for a narrative walkthrough of this API.