Delete a role
curl --request DELETE \
--url https://accounts.livechat.com/v2/roles/{role_id} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://accounts.livechat.com/v2/roles/{role_id}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://accounts.livechat.com/v2/roles/{role_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://accounts.livechat.com/v2/roles/{role_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://accounts.livechat.com/v2/roles/{role_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://accounts.livechat.com/v2/roles/{role_id}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://accounts.livechat.com/v2/roles/{role_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"error": "unauthorized",
"error_description": "The account is not authorized.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "access_denied",
"sub_error": "insufficient_scope",
"error_description": "The resource owner or authorization server denied the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "resource_not_found",
"error_description": "The requested resource couldn't be found.",
"resource_name": "account",
"resource_id": "def31e95-5ca4-4817-b176-732e4544daca",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "invalid_request",
"error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
"invalid_fields": {
"email": "invalid email address"
},
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "server_error",
"error_description": "The server encountered an unexpected condition that prevented it from fulfilling the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}Roles
Delete a role
Delete a single role for a given role_id. Only the custom role can be deleted. All tokens related to a given role will be revoked.
DELETE
/
roles
/
{role_id}
Delete a role
curl --request DELETE \
--url https://accounts.livechat.com/v2/roles/{role_id} \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://accounts.livechat.com/v2/roles/{role_id}"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://accounts.livechat.com/v2/roles/{role_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://accounts.livechat.com/v2/roles/{role_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://accounts.livechat.com/v2/roles/{role_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://accounts.livechat.com/v2/roles/{role_id}")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://accounts.livechat.com/v2/roles/{role_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"error": "unauthorized",
"error_description": "The account is not authorized.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "access_denied",
"sub_error": "insufficient_scope",
"error_description": "The resource owner or authorization server denied the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "resource_not_found",
"error_description": "The requested resource couldn't be found.",
"resource_name": "account",
"resource_id": "def31e95-5ca4-4817-b176-732e4544daca",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "invalid_request",
"error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
"invalid_fields": {
"email": "invalid email address"
},
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}{
"error": "server_error",
"error_description": "The server encountered an unexpected condition that prevented it from fulfilling the request.",
"request_id": "5903c51b-89f0-41a9-a25d-4f39af100353"
}Required scopes:
accounts.roles--all:rwAuthorizations
PersonalAccessTokenOAuth2BearerToken
Use your account ID as the username and your personal access token (PAT) as the password, or pass a Base64-encoded value directly in the Authorization header. For more information, see the personal access tokens guide.
Path Parameters
Unique role ID.
Response
OK: Returns no content.
Was this page helpful?
⌘I