User Groups API

Manage large fleets of administrators via unified User Groups. Supports bulk operations, cascading deletions, and additive role assignments.

The User Groups API manages bulk collections of roles and field restrictions assigned to administrators. Removing a group, restricting a permission, or cascading a deletion updates all attached administrators instantly at their next token refresh.

User Groups CRUD

MethodEndpointDescriptionAuth
GET/api/v1/UserGroupsRetrieve a paginated list of all User Groups. SuperAdmins see global groups; Tenant Admins see only their tenant's.🔒 Required
GET/api/v1/UserGroups/myTenantGroupsQuick-fetch essential group data for the authenticated user's active tenant (optimized for dropdowns).🔒 Required
GET/api/v1/UserGroups/{id}Fetch massive detail for a specific User Group, including all active members, roles, and JSON field restrictions.🔒 Required
GET/api/v1/UserGroups/byTenantId/{tenantId}SuperAdmin only. Fetch groups filtered directly by a specific TenantId.🔒 Required
POST/api/v1/UserGroupsCreate a new User Group, strictly validating that the provided RoleIds exist and belong to the target Tenant.🔒 Required
POST/api/v1/UserGroups/createForMyTenantCreate a new User Group automatically mapped to the JWT's TenantId context.🔒 Required
PUT/api/v1/UserGroups/{id}Update core group metadata (Name, Description, Status) and perform a full nuke-and-pave synchronization of RoleIds.🔒 Required
DELETE/api/v1/UserGroups/{id}Soft-delete a User Group (AdminAdminGroup relations are automatically orphaned).🔒 Required
GET /api/v1/UserGroups/{id} — Response (200 OK)JSON
{
  "id": "ENCRYPTED_USER_GROUP_ID",
  "nameEn": "Finance Team",
  "nameAr": "فريق المالية",
  "code": "FINANCE_TEAM",
  "descriptionEn": "All finance department admins",
  "descriptionAr": "جميع مشرفي القسم المالي",
  "tenantId": "ENCRYPTED_TENANT_ID",
  "isActive": true,
  "members": [
    {
      "adminId": "ENCRYPTED_ADMIN_ID",
      "firstName": "John",
      "lastName": "Doe",
      "username": "johndoe",
      "email": "john@example.com",
      "isActive": true
    }
  ],
  "roles": [
    {
      "roleId": "ENCRYPTED_ROLE_ID",
      "nameEn": "Accountant",
      "nameAr": "محاسب",
      "code": "ACCOUNTANT",
      "permissionCount": 12
    }
  ],
  "restrictions": [
    {
      "permissionCode": "admins.view",
      "restrictedFields": ["salary", "ssn", "bankAccount"]
    }
  ]
}

Group Members

Manage the administrators assigned to a specific User Group.

MethodEndpointDescriptionAuth
POST/api/v1/UserGroups/{groupId}/membersAppend one or more AdminIds to the group. This operation is idempotent.🔒 Required
DELETE/api/v1/UserGroups/{groupId}/members/{adminId}Sever the link between an Admin and the Group. Does not affect the Admin's directly assigned roles.🔒 Required
POST /api/v1/UserGroups/{groupId}/members — RequestJSON
{
  "adminIds": [
    "ENCRYPTED_ADMIN_ID_1",
    "ENCRYPTED_ADMIN_ID_2"
  ]
}

Group Roles & Restrictions

Manage the exact role payloads and field-level serialization blocks inherited by the group's members.

MethodEndpointDescriptionAuth
PUT/api/v1/UserGroups/{groupId}/rolesPerform a destructive, nuke-and-pave synchronization of all RoleIds assigned to the Group.🔒 Required
PUT/api/v1/UserGroups/{groupId}/restrictionsPerform a destructive, nuke-and-pave synchronization of all JSON field restrictions for the Group.🔒 Required
PUT /api/v1/UserGroups/{groupId}/roles — RequestJSON
{
  "roleIds": [
    "ENCRYPTED_ROLE_ID_1",
    "ENCRYPTED_ROLE_ID_2"
  ]
}

Bulk & Cascade Operations

Execute massive operational commands across thousands of records simultaneously, optionally cascading the effects down to the associated member administrators.

MethodEndpointDescriptionAuth
POST/api/v1/UserGroups/bulk/activateBulk set IsActive=true for multiple User Groups. Options to cascade activation to members.🔒 Required
POST/api/v1/UserGroups/bulk/deactivateBulk set IsActive=false for multiple User Groups. Options to cascade deactivation to members.🔒 Required
POST/api/v1/UserGroups/bulk/deleteBulk soft-delete multiple User Groups. Options to cascade soft-delete to members.🔒 Required
POST/api/v1/UserGroups/bulk/activate-allBulk activate all User Groups matching the specified filter criteria (supports cascadeAdmins).🔒 Required
POST/api/v1/UserGroups/bulk/deactivate-allBulk deactivate all User Groups matching the specified filter criteria (supports cascadeAdmins).🔒 Required
POST/api/v1/UserGroups/bulk/delete-allBulk soft-delete all User Groups matching the specified filter criteria (supports cascadeAdmins).🔒 Required
POST /api/v1/UserGroups/bulk/{activate|deactivate|delete} — RequestJSON
{
  "ids": [
    "ENCRYPTED_GROUP_ID_1",
    "ENCRYPTED_GROUP_ID_2"
  ],
  "cascadeAdmins": true
}