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 POST /api/v1/sidebar endpoint creates a new sidebar navigation item in the sidebarItems table. Creating an item does not assign it to any role — it simply registers the item so it can later be linked to one or more roles via POST /api/v1/sidebar/:idItem/role/:idRole. This two-step design lets you create items once and reuse them across multiple roles without duplication.

Authentication

Requires a valid JWT in the Authorization header. The authenticated user’s role must also have the permission POST /api/v1/sidebar registered in the permissions table and assigned via permissionXRole.
Authorization: Bearer <token>

Request

Method: POST
Path: /api/v1/sidebar

Body Parameters

nameItem
string
required
Display label for the navigation item shown in the sidebar menu. Must be between 1 and 100 characters.
iconItem
string
Icon identifier for the navigation item — typically a CSS class name (e.g. "bi bi-speedometer2" for Bootstrap Icons). Maximum 50 characters. Omit or pass null to leave unset.
route
string
Frontend route path this item should navigate to when clicked (e.g. "/dashboard", "/users/list"). Maximum 100 characters. Omit or pass null to leave unset.

Example Request Body

{
  "nameItem": "Reports",
  "iconItem": "bi bi-bar-chart",
  "route": "/reports"
}

Response

201 — Created

Returns the newly created sidebar item, including its auto-generated idItem.
{
  "success": true,
  "message": "Sidebar item creado exitosamente",
  "data": {
    "idItem": 7,
    "nameItem": "Reports",
    "iconItem": "bi bi-bar-chart",
    "route": "/reports"
  }
}
success
boolean
Always true for successful responses.
message
string
Human-readable confirmation: "Sidebar item creado exitosamente".
data
object
The newly created sidebar item object.
data.idItem
integer
Auto-generated numeric ID for the new item (insertId from the database). Use this value in subsequent calls to assign the item to a role.
data.nameItem
string
Display label as provided in the request body.
data.iconItem
string | null
Icon identifier as provided, or null if omitted.
data.route
string | null
Route path as provided, or null if omitted.

400 — Bad Request

Returned when the request body fails schema validation (e.g. nameItem is missing, exceeds length limits, or has the wrong type).
{
  "success": false,
  "message": "nameItem is required"
}

401 — Unauthorized

Returned when the Authorization header is missing or the token is invalid/expired.
{
  "success": false,
  "message": "Token requerido"
}

403 — Forbidden

Returned when the authenticated user’s role does not have the POST /api/v1/sidebar permission.
{
  "success": false,
  "message": "No tienes permisos para acceder a este recurso"
}

Example

curl -X POST http://localhost:{PORT}/api/v1/sidebar \
  -H "Authorization: Bearer <your_jwt_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nameItem": "Reports",
    "iconItem": "bi bi-bar-chart",
    "route": "/reports"
  }'
After creating an item, it is not visible to any user yet. Use POST /api/v1/sidebar/:idItem/role/:idRole to assign the new item to one or more roles. Users with those roles will then see it in their sidebar at next login — sidebar items are delivered as part of the POST /api/v1/auth/login response under the sidebarItems key.

Real-time Events

This endpoint emits Socket.IO events throughout the creation lifecycle:
EventStageDescription
sidebar:createstartCreation process initiated
sidebar:createprocessingItem being persisted to the database
sidebar:createsuccessItem created successfully, payload includes new item data

Build docs developers (and LLMs) love