Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/TheSerchCp/SEAM-API/llms.txt

Use this file to discover all available pages before exploring further.

The SEAM API does not expose a standalone GET /api/v1/sidebar endpoint. Instead, sidebar navigation items are delivered to the client as part of the login response and are resolved server-side using getSidebarItems, which queries the sidebarItems table filtered by the authenticated user’s roleId. This page explains where sidebar data comes from, what it contains, and how the role-based filtering works.

How sidebar items are delivered

When a user authenticates via POST /api/v1/auth/login, the server resolves their roleId from the users table, then calls getSidebarItems(roleId) internally. The result is embedded directly in the login response under the sidebarItems key — no additional request is needed.
{
  "success": true,
  "data": {
    "token": "<jwt>",
    "user": {
      "idUser": 12,
      "full_name": "Ana García",
      "email": "ana@example.com",
      "roleId": 2,
      "roleName": "Manager"
    },
    "sidebarItems": [
      {
        "idItem": 1,
        "nameItem": "Dashboard",
        "iconItem": "bi bi-speedometer2",
        "route": "/dashboard"
      },
      {
        "idItem": 3,
        "nameItem": "Reports",
        "iconItem": "bi bi-bar-chart",
        "route": "/reports"
      }
    ]
  }
}
The client should store sidebarItems from the login response and use it to build the navigation menu without making a subsequent request.

What getSidebarItems queries

AuthRepository.getSidebarItems(roleId) executes the following SQL:
SELECT s.idItem, s.nameItem, s.iconItem, s.route
FROM sidebarItems s
INNER JOIN roleXItem ri ON s.idItem = ri.itemId
WHERE ri.roleId = ?
ORDER BY s.idItem
Only items linked to the user’s role via the roleXItem pivot table are returned. Items that exist in sidebarItems but have not been assigned to the role are excluded. The results are ordered by idItem ascending.

Response fields

sidebarItems
array
Array of sidebar navigation item objects assigned to the user’s role. Returned inside data in the login response. Empty array [] if the role has no items assigned.
sidebarItems[].idItem
integer
Unique numeric identifier of the sidebar item, sourced from the sidebarItems table primary key.
sidebarItems[].nameItem
string
Display label shown in the navigation menu (e.g. "Dashboard", "Reports").
sidebarItems[].iconItem
string | null
Icon identifier for the navigation item (e.g. a CSS class like "bi bi-speedometer2"). null if no icon was set when the item was created.
sidebarItems[].route
string | null
Frontend route path the item links to (e.g. "/dashboard"). null if no route was set.

Role-scoped visibility

Each user’s sidebar is determined entirely by their roleId. Two users with different roles will receive different sidebarItems arrays even though they call the same login endpoint. This is enforced by the INNER JOIN roleXItem — items not assigned to a role are never included. To make a sidebar item visible to users of a specific role, use POST /api/v1/sidebar/:idItem/role/:idRole to create the assignment in roleXItem. To create the item itself first, use POST /api/v1/sidebar.

Typical client workflow

1

Authenticate

Call POST /api/v1/auth/login with valid credentials. The sidebarItems array in the response contains all navigation items for the authenticated user’s role.
curl -X POST http://localhost:{PORT}/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{ "email": "ana@example.com", "password": "secret" }'
2

Store and render

Persist sidebarItems from the response (e.g. in application state or local storage alongside the token) and use it to render the navigation menu. Each item provides nameItem for the label, iconItem for an optional icon, and route for the target path.
3

Re-authenticate to refresh

Because there is no standalone GET endpoint, sidebar items are refreshed by performing a new login. If your application needs to refresh navigation without a full re-login cycle, contact the API maintainer about adding a dedicated sidebar retrieval route.
If you need to inspect which items are assigned to a role without going through login, use the database directly or query the roleXItem and sidebarItems tables. A dedicated management endpoint for listing items does not currently exist in sidebar.routes.js.

Build docs developers (and LLMs) love