Update an access role with version protection
Requires a signed-in team user, the team_access_roles_v1 rollout and Manage Access roles (groups). API keys remain accepted by route middleware but cannot replace the user actor required by this controller. Omitted name/permissions retain their existing values; a null name becomes empty and is rejected. Permissions must satisfy registered prerequisites and the actor ceiling. Full-access inherited positives stay locked; self-lockout is refused. A no-op retains the version.
curl --request PUT \
--url https://api.gratona.com/v1/admin/access/roles/{role_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": 2,
"source": "<string>",
"name": "<string>",
"permissions": {}
}
'import requests
url = "https://api.gratona.com/v1/admin/access/roles/{role_id}"
payload = {
"expected_version": 2,
"source": "<string>",
"name": "<string>",
"permissions": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expected_version: 2, source: '<string>', name: '<string>', permissions: {}})
};
fetch('https://api.gratona.com/v1/admin/access/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://api.gratona.com/v1/admin/access/roles/{role_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'expected_version' => 2,
'source' => '<string>',
'name' => '<string>',
'permissions' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gratona.com/v1/admin/access/roles/{role_id}"
payload := strings.NewReader("{\n \"expected_version\": 2,\n \"source\": \"<string>\",\n \"name\": \"<string>\",\n \"permissions\": {}\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.gratona.com/v1/admin/access/roles/{role_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expected_version\": 2,\n \"source\": \"<string>\",\n \"name\": \"<string>\",\n \"permissions\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/access/roles/{role_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expected_version\": 2,\n \"source\": \"<string>\",\n \"name\": \"<string>\",\n \"permissions\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"version": 123,
"can_manage": true,
"role": {
"id": 123,
"name": "<string>",
"is_full_access": true,
"member_count": 123,
"version": 123,
"access_summary": {
"level": "<string>",
"source": "<string>",
"label": "<string>"
},
"members": [
{
"id": 123,
"name": "<string>",
"email": "<string>",
"is_active": true,
"role_id": 123,
"access_assignment_version": 123
}
],
"stored_permissions": {},
"effective_access": {},
"access_by_area": {},
"restrictions": [
"<string>"
],
"editor_schema": {
"version": 123,
"role_id": 123,
"role_version": 123,
"affected_member_count": 123,
"editable": true,
"reason": "<string>",
"stored_permissions": {},
"stored_permissions_when_full_access_removed": {},
"sections": [
{
"id": "<string>",
"title": "<string>",
"description": "<string>",
"type": "<string>",
"items": [
{
"id": "<string>",
"type": "<string>",
"area": "<string>",
"label": "<string>",
"description": "<string>",
"key": "<string>",
"key_prefix": "<string>",
"kind": "<string>",
"polarity": "<string>",
"availability": "<string>",
"resource_type": "<string>",
"editable": true,
"reason": "<string>",
"editable_when_full_access_removed": true,
"affected_member_count": 123,
"version": 123,
"keys": [
"<string>"
],
"current": {
"stored": true,
"effective": true,
"level": "<string>",
"source": "<string>"
},
"current_when_full_access_removed": {
"stored": true,
"effective": true,
"level": "<string>",
"source": "<string>"
},
"allowed_values": [
{
"value": "<string>",
"label": "<string>",
"enabled": true,
"reason": "<string>"
}
],
"allowed_values_when_full_access_removed": [
{
"value": "<string>",
"label": "<string>",
"enabled": true,
"reason": "<string>"
}
],
"prerequisites": [
{
"key": "<string>",
"label": "<string>"
}
],
"resources": [
{
"id": 123,
"label": "<string>",
"key": "<string>",
"current": {
"stored": true,
"effective": true,
"level": "<string>",
"source": "<string>"
},
"current_when_full_access_removed": {
"stored": true,
"effective": true,
"level": "<string>",
"source": "<string>"
},
"allowed_values": [
{
"value": "<string>",
"label": "<string>",
"enabled": true,
"reason": "<string>"
}
],
"editable": true,
"reason": "<string>",
"editable_when_full_access_removed": true,
"allowed_values_when_full_access_removed": [
{
"value": "<string>",
"label": "<string>",
"enabled": true,
"reason": "<string>"
}
]
}
]
}
]
}
]
}
},
"allowed_transitions": {
"can_edit": true,
"can_delete": true,
"can_assign": true,
"is_full_access_locked": true,
"requires_expected_version": true,
"advisory": true
}
}
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"message": "Not Found",
"status": "error"
}{
"message": "<string>",
"error_code": "ACCESS_ROLE_VERSION_CONFLICT",
"expected_version": 123,
"actual_version": 123
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}Authorizations
Passport bearer token authentication for legacy admin sessions.
Headers
Optional correlation ID recorded with the access audit event.
Path Parameters
Role id.
x >= 1Body
Request fields accepted by this operation. Omitted optional properties retain the behavior described above.
Validation: required|integer|min:1.
x >= 1Validation: required|string|max:120.
120Validation: nullable|string|min:3|max:255.
3 - 255Permission map using registered editor keys. Null or omission preserves permissions. True, 1, 1 and true normalize to enabled; other values normalize to disabled, recursively for legacy arrays. Existing explicit denies and restrictions can persist when omitted. Unknown new keys are ignored; unsafe escalation is rejected. Use stored_permissions and editor transitions for a complete edit.
Response
Update an access role with version protection response.
Show child attributes
Show child attributes
curl --request PUT \
--url https://api.gratona.com/v1/admin/access/roles/{role_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": 2,
"source": "<string>",
"name": "<string>",
"permissions": {}
}
'import requests
url = "https://api.gratona.com/v1/admin/access/roles/{role_id}"
payload = {
"expected_version": 2,
"source": "<string>",
"name": "<string>",
"permissions": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expected_version: 2, source: '<string>', name: '<string>', permissions: {}})
};
fetch('https://api.gratona.com/v1/admin/access/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://api.gratona.com/v1/admin/access/roles/{role_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'expected_version' => 2,
'source' => '<string>',
'name' => '<string>',
'permissions' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gratona.com/v1/admin/access/roles/{role_id}"
payload := strings.NewReader("{\n \"expected_version\": 2,\n \"source\": \"<string>\",\n \"name\": \"<string>\",\n \"permissions\": {}\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.gratona.com/v1/admin/access/roles/{role_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expected_version\": 2,\n \"source\": \"<string>\",\n \"name\": \"<string>\",\n \"permissions\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/access/roles/{role_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expected_version\": 2,\n \"source\": \"<string>\",\n \"name\": \"<string>\",\n \"permissions\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"version": 123,
"can_manage": true,
"role": {
"id": 123,
"name": "<string>",
"is_full_access": true,
"member_count": 123,
"version": 123,
"access_summary": {
"level": "<string>",
"source": "<string>",
"label": "<string>"
},
"members": [
{
"id": 123,
"name": "<string>",
"email": "<string>",
"is_active": true,
"role_id": 123,
"access_assignment_version": 123
}
],
"stored_permissions": {},
"effective_access": {},
"access_by_area": {},
"restrictions": [
"<string>"
],
"editor_schema": {
"version": 123,
"role_id": 123,
"role_version": 123,
"affected_member_count": 123,
"editable": true,
"reason": "<string>",
"stored_permissions": {},
"stored_permissions_when_full_access_removed": {},
"sections": [
{
"id": "<string>",
"title": "<string>",
"description": "<string>",
"type": "<string>",
"items": [
{
"id": "<string>",
"type": "<string>",
"area": "<string>",
"label": "<string>",
"description": "<string>",
"key": "<string>",
"key_prefix": "<string>",
"kind": "<string>",
"polarity": "<string>",
"availability": "<string>",
"resource_type": "<string>",
"editable": true,
"reason": "<string>",
"editable_when_full_access_removed": true,
"affected_member_count": 123,
"version": 123,
"keys": [
"<string>"
],
"current": {
"stored": true,
"effective": true,
"level": "<string>",
"source": "<string>"
},
"current_when_full_access_removed": {
"stored": true,
"effective": true,
"level": "<string>",
"source": "<string>"
},
"allowed_values": [
{
"value": "<string>",
"label": "<string>",
"enabled": true,
"reason": "<string>"
}
],
"allowed_values_when_full_access_removed": [
{
"value": "<string>",
"label": "<string>",
"enabled": true,
"reason": "<string>"
}
],
"prerequisites": [
{
"key": "<string>",
"label": "<string>"
}
],
"resources": [
{
"id": 123,
"label": "<string>",
"key": "<string>",
"current": {
"stored": true,
"effective": true,
"level": "<string>",
"source": "<string>"
},
"current_when_full_access_removed": {
"stored": true,
"effective": true,
"level": "<string>",
"source": "<string>"
},
"allowed_values": [
{
"value": "<string>",
"label": "<string>",
"enabled": true,
"reason": "<string>"
}
],
"editable": true,
"reason": "<string>",
"editable_when_full_access_removed": true,
"allowed_values_when_full_access_removed": [
{
"value": "<string>",
"label": "<string>",
"enabled": true,
"reason": "<string>"
}
]
}
]
}
]
}
]
}
},
"allowed_transitions": {
"can_edit": true,
"can_delete": true,
"can_assign": true,
"is_full_access_locked": true,
"requires_expected_version": true,
"advisory": true
}
}
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"message": "Not Found",
"status": "error"
}{
"message": "<string>",
"error_code": "ACCESS_ROLE_VERSION_CONFLICT",
"expected_version": 123,
"actual_version": 123
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}