Skip to main content
GET
/
api
/
v1
/
users
List Users
curl --request GET \
  --url https://api.example.com/api/v1/users
{
  "success": true,
  "data": [
    {
      "id": "770e8400-e29b-41d4-a716-446655440000",
      "name": "Juan Pérez",
      "username": "jperez",
      "email": "[email protected]",
      "phone": "8091234567",
      "role": "VENDEDOR",
      "ventanaId": "660e8400-e29b-41d4-a716-446655440000",
      "code": "V001",
      "isActive": true,
      "settings": {
        "theme": "dark",
        "print": {
          "width": 58
        }
      },
      "platform": "android",
      "appVersion": "2.0.7",
      "createdAt": "2024-03-15T12:00:00Z",
      "updatedAt": "2024-03-15T12:00:00Z"
    }
  ],
  "meta": {
    "page": 1,
    "pageSize": 10,
    "total": 1,
    "totalPages": 1
  }
}

Overview

Retrieves a paginated list of users with optional filtering. VENTANA users can only see VENDEDOR users within their own ventana.

Authorization

Required role: ADMIN or VENTANA
Permissions:
  • ADMIN: Can see all users
  • VENTANA: Can only see active VENDEDOR users in their ventana (automatically filtered)

Query Parameters

page
number
default:"1"
Page number (must be positive integer)
pageSize
number
default:"10"
Number of items per page (1-100)
role
string
Filter by role: “ADMIN”, “VENTANA”, or “VENDEDOR”
Search term to filter users. Searches across name, username, email, phone, and code fields.
isActive
boolean
Filter by active status. For VENTANA users, defaults to true if not specified.

Response

success
boolean
Indicates if the request was successful
data
array
Array of user objects (password field excluded)
meta
object
Pagination metadata
{
  "success": true,
  "data": [
    {
      "id": "770e8400-e29b-41d4-a716-446655440000",
      "name": "Juan Pérez",
      "username": "jperez",
      "email": "[email protected]",
      "phone": "8091234567",
      "role": "VENDEDOR",
      "ventanaId": "660e8400-e29b-41d4-a716-446655440000",
      "code": "V001",
      "isActive": true,
      "settings": {
        "theme": "dark",
        "print": {
          "width": 58
        }
      },
      "platform": "android",
      "appVersion": "2.0.7",
      "createdAt": "2024-03-15T12:00:00Z",
      "updatedAt": "2024-03-15T12:00:00Z"
    }
  ],
  "meta": {
    "page": 1,
    "pageSize": 10,
    "total": 1,
    "totalPages": 1
  }
}

Notes

  • Password field is never included in response
  • VENTANA users automatically filtered to see only their vendedores (see src/api/v1/controllers/user.controller.ts:59-82)
  • For VENTANA role, isActive defaults to true if not specified (see src/api/v1/controllers/user.controller.ts:63-65)
  • ADMIN can see all users including inactive ones (see src/api/v1/controllers/user.controller.ts:87-94)
  • Search uses PostgreSQL trigram indexes for fuzzy matching
  • Soft-deleted users are excluded from results

Build docs developers (and LLMs) love