Grant an operational administrator
/api/v1/admin-assignmentsGrants an administrator role to a user who must be an active member of the Account (400 otherwise). The grant must match the role's scope: an account role needs scopeType account with no environmentId or nodeId, and an environment role needs an environmentId with scopeType environment, or node plus a nodeId in that Environment. Answers 404 when the role, Environment or node is not in the Account, 400 when effectiveFrom is not before effectiveTo, and 409 when the same grant is already live in an overlapping window. Requires admin_governance.manage, and the grant is recorded in the audit log. An API key may only put in a role, or grant a role carrying, capabilities its own scopes cover; anything beyond answers 403 (admin_role.capability_beyond_key) naming them in error.data.capabilities. Two capabilities are beyond every key whatever it holds, because the person given one hands out authority without the key's bound: admin_governance.manage (any role) and api_keys.manage (a full-access Environment key). A developer's MCP client, when its approval names only some capabilities, is held to them the same way, and never hands out those two (403, admin_role.capability_beyond_mcp_grant).
Authentication
Authorization Option A JWT access token. Never send alongside X-API-Key: a request carrying both is refused.
X-API-Key Option B API key for management-tier access. Never send alongside an Authorization header: a request carrying both is refused.
admin_governance.manageAccountCreate administrator roles and grant them, carrying only capabilities this key's own scopes cover. A scoped API key must hold it as a scope; a full-access key holds every scope within its Environment except the named-only and account scopes; a developer's token needs the Console capability that covers it. A credential without it is refused with 403.
Request body
application/json
userIdstring Required User receiving the administrator role
adminRoleIdstring Required Administrator role to grant
environmentIdstring Optional Environment the authority applies within — omitted for an account-wide grant
scopeTypeenum Required How far the authority reaches: the whole Account, one Environment, or one hierarchy node and its descendants. Must match the role's scope.
nodeIdstring Optional Hierarchy node — required when scopeType is 'node'
effectiveFromstring Optional When the authority becomes effective
effectiveTostring Optional When the authority expires
Responses
application/json
data *AdminAssignmentResponseDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
Errors
When the request can't be completed, the response body includes a stable error code you can branch on, and a correlation_id (also sent as the X-Correlation-Id header). Quote the correlation id when you contact support: it identifies the exact request in Canopy's logs. A request refused by an authorization check answers 403 with the code authorization.denied, and its data names the denial_reason and the permission checked.
authorization.deniedForbiddenThe credential does not hold the permission this operation checks: a scoped API key without the scope, a developer without the Console capability that covers it, or a permission granted somewhere other than the node the request targets. The error's data names the permission.
Add the permission named in the Authentication section to the key's scopes, or ask an account administrator to grant the covering capability, then retry. For a node-scoped operation, make sure the grant reaches the node you are acting on.
Returned object
curl -X POST "https://auth.canopy-io.com/api/v1/admin-assignments" \ -H "X-API-Key: $CANOPY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "userId": "string", "adminRoleId": "string", "environmentId": "string", "scopeType": "account", "nodeId": "string", "effectiveFrom": "string", "effectiveTo": "string" }'
{ "data": { "id": "string", "admin_role_id": "string", "user_id": "string", "environment_id": "string", "scope_type": "account", "application_node_id": "string", "effective_from": "2026-04-20T12:00:00.000Z", "effective_to": "2026-04-20T12:00:00.000Z", "revoked_at": "2026-04-20T12:00:00.000Z", "created_at": "2026-04-20T12:00:00.000Z", "updated_at": "2026-04-20T12:00:00.000Z" } }
Tell us how we can improve this guide.