cURL
curl -X POST "https://app.cotool.ai/api/roles/:id/perms" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"toAdd":[{"resource":{"type":"all"},"action":"agent.create"}],"toRemove":[{"resource":{"type":"all"},"action":"agent.create"}]}'import requests
url = "https://app.cotool.ai/api/roles/{id}/perms"
payload = {
"toAdd": [
{
"resource": { "type": "all" },
"action": "agent.create"
}
],
"toRemove": [
{
"resource": { "type": "all" },
"action": "agent.create"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
toAdd: [{resource: {type: 'all'}, action: 'agent.create'}],
toRemove: [{resource: {type: 'all'}, action: 'agent.create'}]
})
};
fetch('https://app.cotool.ai/api/roles/{id}/perms', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://app.cotool.ai/api/roles/{id}/perms")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"toAdd\": [\n {\n \"resource\": {\n \"type\": \"all\"\n },\n \"action\": \"agent.create\"\n }\n ],\n \"toRemove\": [\n {\n \"resource\": {\n \"type\": \"all\"\n },\n \"action\": \"agent.create\"\n }\n ]\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.cotool.ai/api/roles/{id}/perms"
payload := strings.NewReader("{\n \"toAdd\": [\n {\n \"resource\": {\n \"type\": \"all\"\n },\n \"action\": \"agent.create\"\n }\n ],\n \"toRemove\": [\n {\n \"resource\": {\n \"type\": \"all\"\n },\n \"action\": \"agent.create\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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))
}{
"perms": [
{
"resource": {
"type": "all"
},
"action": "agent.create"
}
]
}{
"error": "<string>",
"issues": [
{}
]
}{
"error": "<string>"
}{
"error": "<string>",
"missingPerms": [
"<string>"
]
}{
"error": "<string>"
}Roles
Apply permission diff to a role
Apply a permission diff to a specific role
POST
/
api
/
roles
/
{id}
/
perms
cURL
curl -X POST "https://app.cotool.ai/api/roles/:id/perms" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"toAdd":[{"resource":{"type":"all"},"action":"agent.create"}],"toRemove":[{"resource":{"type":"all"},"action":"agent.create"}]}'import requests
url = "https://app.cotool.ai/api/roles/{id}/perms"
payload = {
"toAdd": [
{
"resource": { "type": "all" },
"action": "agent.create"
}
],
"toRemove": [
{
"resource": { "type": "all" },
"action": "agent.create"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
toAdd: [{resource: {type: 'all'}, action: 'agent.create'}],
toRemove: [{resource: {type: 'all'}, action: 'agent.create'}]
})
};
fetch('https://app.cotool.ai/api/roles/{id}/perms', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://app.cotool.ai/api/roles/{id}/perms")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"toAdd\": [\n {\n \"resource\": {\n \"type\": \"all\"\n },\n \"action\": \"agent.create\"\n }\n ],\n \"toRemove\": [\n {\n \"resource\": {\n \"type\": \"all\"\n },\n \"action\": \"agent.create\"\n }\n ]\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.cotool.ai/api/roles/{id}/perms"
payload := strings.NewReader("{\n \"toAdd\": [\n {\n \"resource\": {\n \"type\": \"all\"\n },\n \"action\": \"agent.create\"\n }\n ],\n \"toRemove\": [\n {\n \"resource\": {\n \"type\": \"all\"\n },\n \"action\": \"agent.create\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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))
}{
"perms": [
{
"resource": {
"type": "all"
},
"action": "agent.create"
}
]
}{
"error": "<string>",
"issues": [
{}
]
}{
"error": "<string>"
}{
"error": "<string>",
"missingPerms": [
"<string>"
]
}{
"error": "<string>"
}Authorizations
API Key authentication for programmatic access. Include your API key in the Authorization header as: Bearer your_api_key_here
Path Parameters
Body
application/json
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
- Option 20
- Option 21
- Option 22
- Option 23
- Option 24
- Option 25
- Option 26
- Option 27
- Option 28
- Option 29
Show child attributes
Show child attributes
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
- Option 20
- Option 21
- Option 22
- Option 23
- Option 24
- Option 25
- Option 26
- Option 27
- Option 28
- Option 29
Show child attributes
Show child attributes
Response
Successful response
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
- Option 20
- Option 21
- Option 22
- Option 23
- Option 24
- Option 25
- Option 26
- Option 27
- Option 28
- Option 29
Show child attributes
Show child attributes
Was this page helpful?
⌘I