Bulk-create role assignments. All-or-nothing: any failure rolls back the entire batch
/api/v1/assignments/bulk-createAuthentication
- Bearer Token
AuthorizationJWT access token
- API Key
X-API-KeyAPI key for management-tier access
Request body
assignments *BulkCreateAssignmentItemDto[]
Code samples
curl -X POST "https://api.canopy.dev/api/v1/assignments/bulk-create" \
-H "X-API-Key: $CANOPY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"assignments": [
{
"identity_id": "string",
"node_id": "string",
"role_id": "string",
"effective_from": "string",
"effective_to": "string"
}
]
}'const response = await fetch("https://api.canopy.dev/api/v1/assignments/bulk-create", {
method: "POST",
headers: {
"X-API-Key": "$CANOPY_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"assignments": [
{
"identity_id": "string",
"node_id": "string",
"role_id": "string",
"effective_from": "string",
"effective_to": "string"
}
]
}),
});
const data = await response.json();import requests
response = requests.post(
"https://api.canopy.dev/api/v1/assignments/bulk-create",
headers={
"X-API-Key": "$CANOPY_API_KEY",
"Content-Type": "application/json"
},
json={
"assignments": [
{
"identity_id": "string",
"node_id": "string",
"role_id": "string",
"effective_from": "string",
"effective_to": "string",
},
],
},
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"assignments": []interface{}{
map[string]interface{}{
"identity_id": "string",
"node_id": "string",
"role_id": "string",
"effective_from": "string",
"effective_to": "string",
},
},
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.canopy.dev/api/v1/assignments/bulk-create", 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 Assignments created — all items succeeded
{
"summary": {
"total": 0,
"succeeded": 0,
"failed": 0
},
"results": [
{
"index": 0,
"status": "success",
"code": 0,
"data": {
"id": "string",
"identity_id": "string",
"application_node_id": "string",
"role_id": "string",
"effective_from": "2026-04-20T12:00:00.000Z",
"effective_to": "2026-04-20T12:00:00.000Z",
"created_at": "2026-04-20T12:00:00.000Z",
"updated_at": "2026-04-20T12:00:00.000Z"
}
}
]
}application/json
summary *objectresults *object[]
207 Assignments created — mixed outcomes (one or more items failed)
{
"summary": {
"total": 0,
"succeeded": 0,
"failed": 0
},
"results": [
{
"index": 0,
"status": "success",
"code": 0,
"data": {
"id": "string",
"identity_id": "string",
"application_node_id": "string",
"role_id": "string",
"effective_from": "2026-04-20T12:00:00.000Z",
"effective_to": "2026-04-20T12:00:00.000Z",
"created_at": "2026-04-20T12:00:00.000Z",
"updated_at": "2026-04-20T12:00:00.000Z"
}
},
{
"index": 0,
"status": "error",
"code": 0,
"input": {},
"error": {
"code": "string",
"message": "string",
"details": {}
}
}
]
}application/json
summary *objectresults *("success" | "error")[]
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)