Bulk change role on assignments
/api/v1/assignments/bulk-change-roleAuthentication
- Bearer Token
AuthorizationJWT access token
- API Key
X-API-KeyAPI key for management-tier access
Request body
assignment_ids *string[]role_id *string
Code samples
curl -X POST "https://api.canopy.dev/api/v1/assignments/bulk-change-role" \
-H "X-API-Key: $CANOPY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"assignment_ids": [
"string"
],
"role_id": "string"
}'const response = await fetch("https://api.canopy.dev/api/v1/assignments/bulk-change-role", {
method: "POST",
headers: {
"X-API-Key": "$CANOPY_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"assignment_ids": [
"string"
],
"role_id": "string"
}),
});
const data = await response.json();import requests
response = requests.post(
"https://api.canopy.dev/api/v1/assignments/bulk-change-role",
headers={
"X-API-Key": "$CANOPY_API_KEY",
"Content-Type": "application/json"
},
json={
"assignment_ids": [
"string",
],
"role_id": "string",
},
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"assignment_ids": []interface{}{
"string",
},
"role_id": "string",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.canopy.dev/api/v1/assignments/bulk-change-role", 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 Roles updated
{
"message": "string"
}application/json
message *string
400 System roles cannot be assigned to identities — they are reserved for platform administration
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)