Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/tukit/llms.txt

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

This admin-only endpoint returns a paginated list of every registered user in the TuKit database, ordered by createdAt ascending (oldest accounts first). Pagination is handled by the Paginate middleware, which reads the optional pag and perpage path parameters and attaches skippag and limit values to req.body before the controller runs. The requesting user must be identified by adminId in the URL and must hold the role { name: "admin", value: "2" } — standard users will receive a 203 rejection. Pagination metadata is returned alongside the user array so clients can implement page-based navigation. POST /api/user/list/:adminId/user/:pag?/:perpage?

Authentication

token-access
string
required
A valid JWT obtained from the Login endpoint.

Path Parameters

adminId
string
required
The MongoDB ObjectId of the requesting administrator. This account must carry the role { name: "admin", value: "2" } or the request will be rejected.
pag
number
The page number to retrieve. Defaults to 1 when omitted. Must be a positive integer.
perpage
number
The number of user records to return per page. Defaults to 10 when omitted.

Request Body

No request body is required for this endpoint. Pagination values (skippag, limit) are computed and injected by the Paginate middleware from the path parameters.

Response

200 — Success

msj
string
Loading message returned with the data: "Cargando usuarios...".
status
boolean
Always true on success.
data
array
Array of user documents matching the current page. Users are sorted by createdAt ascending.
pagination
object
Metadata about the current page and total pages available.

Error Responses

StatusCause
203The adminId account does not hold the role { name: "admin", value: "2" }, or no user document was found for adminId.
500Unexpected server or database error.
The result set is sorted by createdAt in ascending order — the oldest registered accounts appear first. Use the pag and perpage path parameters to navigate through large user bases.

Examples

Page 1, 10 users per page (defaults):
curl -X POST https://your-tukit-api.com/api/user/list/64f9z9z9z9z9z9z9z9z9z9z9/user \
  -H "token-access: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
Page 2, 5 users per page:
curl -X POST https://your-tukit-api.com/api/user/list/64f9z9z9z9z9z9z9z9z9z9z9/user/2/5 \
  -H "token-access: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
Success response:
{
  "msj": "Cargando usuarios...",
  "status": true,
  "data": [
    {
      "_id": "64f1a2b3c4d5e6f7a8b9c0d1",
      "userName": "MarcosDesigns",
      "email": "marcos@example.com",
      "roles": [{ "name": "Usuario", "value": "1" }],
      "activate": [{ "name": "Activado", "value": "1" }],
      "createdAt": "2024-06-01T12:00:00.000Z",
      "updatedAt": "2024-06-02T09:30:00.000Z"
    },
    {
      "_id": "64f2b3c4d5e6f7a8b9c0d2e3",
      "userName": "LauraSport",
      "email": "laura@example.com",
      "roles": [{ "name": "Usuario", "value": "1" }],
      "activate": [{ "name": "Activado", "value": "1" }],
      "createdAt": "2024-06-03T08:15:00.000Z",
      "updatedAt": "2024-06-03T08:15:00.000Z"
    }
  ],
  "pagination": {
    "pag": "1",
    "perpage": 10,
    "pags": 5
  }
}
Error — requestor lacks admin role:
{
  "msj": "No tienes permisos para esta función",
  "status": false
}

Build docs developers (and LLMs) love