1. Docs
  2. API Reference
  3. Grant an operational administrator

Grant an operational administrator

POST/portal/v1/accounts/{accountSlug}/admin-assignments

Grants 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.

Authentication

Bearer TokenAuthorization

JWT access token. Never send alongside X-API-Key: a request carrying both is refused.

Path Parameters

accountSlugstring Required

The Account's slug. An unknown one answers 404.

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.

one of "account" · "environment" · "node"

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

  • dataAdminAssignmentResponseDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

Returned object

Request
curl -X POST "https://auth.canopy-io.com/portal/v1/accounts/value/admin-assignments" \
  -H "Authorization: Bearer $CANOPY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "string",
    "adminRoleId": "string",
    "environmentId": "string",
    "scopeType": "account",
    "nodeId": "string",
    "effectiveFrom": "string",
    "effectiveTo": "string"
  }'
Response
{
  "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"
  }
}
Related endpoints
GETList operational administrators in an Environment
DELETERevoke an operational administrator
Was this page helpful?

Tell us how we can improve this guide.