Replace permissions on a role
/api/v1/roles/{id}/permissionsAuthentication
- Bearer Token
AuthorizationJWT access token
- API Key
X-API-KeyAPI key for management-tier access
Path Parameters
| Name | Required | Type | Description |
|---|---|---|---|
id | string |
Request body
permission_keys *string[]
Code samples
curl -X PUT "https://api.canopy.dev/api/v1/roles/value/permissions" \
-H "X-API-Key: $CANOPY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"permission_keys": [
"string"
]
}'const response = await fetch("https://api.canopy.dev/api/v1/roles/value/permissions", {
method: "PUT",
headers: {
"X-API-Key": "$CANOPY_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"permission_keys": [
"string"
]
}),
});
const data = await response.json();import requests
response = requests.put(
"https://api.canopy.dev/api/v1/roles/value/permissions",
headers={
"X-API-Key": "$CANOPY_API_KEY",
"Content-Type": "application/json"
},
json={
"permission_keys": [
"string",
],
},
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"permission_keys": []interface{}{
"string",
},
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("PUT", "https://api.canopy.dev/api/v1/roles/value/permissions", bytes.NewBuffer(body))
req.Header.Set("X-API-Key", "$CANOPY_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}Responses
200 Permissions updated
{
"message": "string"
}application/json
message *string
401 Invalid or expired token
403 This token is not authorized for this endpoint (wrong principal type — e.g., admin token on identity-only endpoint, or vice versa)
404 Role not found