Administrative endpoints that power the Permisos GOAL → Explorador UI: hierarchical GOAL V2 modules with permission leaves, plus company-scoped role assignments.
Base path: /api/v1/backend/auth/permissions
Required headers:
Authorization: Bearer <token>
x-app-stage: <stage>
x-app-uid: <app-uid>
Query (all endpoints): companyId — validated by company-validator middleware.
Responses use the standard ActionResult envelope: { "success": true, "message": "...", "data": ... }.
GET /api/v1/backend/auth/permissions/explorer-tree
Permission: GOAL_V2_AUTH_PERMISSION_PERMISSION_LIST
Query parameters:
| Parameter | Type | Description |
|---|---|---|
companyId |
int | Active company |
view |
string | Permission status filter: A (default), I, D, ALL |
rootModuleId |
int | Optional; defaults to GOAL V2 root (GOAL / version V2) |
compact |
bool | 1 omits redundant fields (description, translation_labels, duplicate name when equal to display_name) |
locale |
string | Display locale for display_name (default es) |
depth |
int | Optional max depth; deeper branches return lazy_children: true with empty children |
HTTP caching: response includes ETag. Send If-None-Match with the prior ETag to receive 304 Not Modified (no JSON body).
Response (200 OK): array of tree nodes (typically one root). Each node:
| Field | Description |
|---|---|
id |
Stable tree id: m-{moduleId} or p-{permissionId} |
node_kind |
module or permission |
entity_id |
Underlying module or permission primary key |
name, code, type, prefix, level |
Module metadata (modules only); name is canonical English |
display_name |
Locale-aware label for UI (default es) |
translation_labels |
JSON map locale → display string (pass-through for clients) |
type_display |
Localized module type chip (e.g. Modelo) |
label |
Legacy Spanish label on permission leaves |
permission_count |
Descendant permission count (modules only) |
children |
Nested nodes |
Example:
{
"success": true,
"message": "Proceso realizado correctamente",
"data": [
{
"id": "m-1",
"node_kind": "module",
"entity_id": 1,
"name": "Goal Version 2",
"code": "GOAL",
"type": "ROOT",
"permission_count": 1200,
"children": []
}
]
}
Errors: 401, 403, 500
GET /api/v1/backend/auth/permissions/explorer-tree/children
Permission: GOAL_V2_AUTH_PERMISSION_PERMISSION_LIST
| Parameter | Type | Description |
|---|---|---|
companyId |
int | Active company |
parentModuleId |
int | Required module id |
view |
string | Same as explorer tree |
compact, locale |
Same as explorer tree |
Response (200 OK): array of direct child module nodes and permission leaves for the parent module (no deep recursion). Modules that still have descendants may include lazy_children: true.
Supports ETag / If-None-Match like the full tree.
GET /api/v1/backend/auth/permissions/explorer-search
Permission: GOAL_V2_AUTH_PERMISSION_PERMISSION_LIST
| Parameter | Type | Description |
|---|---|---|
companyId |
int | Active company |
q |
string | Required, min 2 characters |
view, locale, limit |
Optional (limit max 100) |
Response (200 OK): flat array (max 100) of permission hits with tree_id, code, display_name, module_id, module_name.
GET /api/v1/backend/auth/permissions/{id}/company-roles
Permission: G2_ADMIN_ROLES_VIEW_ROLE_LIST
Query: companyId, optional view (A / I / ALL)
Response (200 OK): array of company roles in the selected company that have an assignment row for the permission.
{
"success": true,
"data": [
{
"id": 5,
"code": "ADMIN",
"name": "Administrador",
"status": "A",
"assigned_at": "2025-09-01 10:00:00",
"assigned_by_user": { "id": 1, "name": "Admin", "email": "admin@example.com" },
"permissions_count": 1
}
]
}
Errors: 404 (permission not found), 401, 403, 500
GET /api/v1/backend/auth/permissions/explorer-module-company-roles
Permission: G2_ADMIN_ROLES_VIEW_ROLE_LIST
Query:
| Parameter | Required | Description |
|---|---|---|
companyId |
yes | Company scope |
moduleId |
yes | Selected module node |
view |
no | Status filter (A default) |
Response (200 OK): distinct company roles with at least one permission in the module subtree.
{
"success": true,
"data": [
{
"id": 5,
"code": "ADMIN",
"name": "Administrador",
"status": "A",
"permissions_count": 12,
"assigned_at": "2025-10-01 08:30:00",
"sample_permission_codes": ["GOAL_V2_SALES_ORDER_LIST", "GOAL_V2_SALES_ORDER_INSERT"]
}
]
}
Errors: 404 (module not found), 400 (missing params), 401, 403, 500
Export/import translation_labels for modules and permissions: Permissions Translation Catalog API.