API Reference
Users Management
Fetch Revoked Users (Paginated)

User Management – Fetch Revoked Users with Pagination

Fetch revoked (deleted) organization users with server-side pagination, sorting, and search capabilities.

Authentication

Authorization: Bearer <YOUR_AUTH_TOKEN>

Endpoint

POSThttps://api.samvyo.com/api/user/fetchDeletedOrgUsersWithPagination

Required Headers

Content-Type: application/json
Authorization: Bearer <YOUR_AUTH_TOKEN>

Request Body

{
  "role": "moderator",
  "page": 1,
  "limit": 25,
  "sortBy": "name",
  "sortOrder": "ASC",
  "search": "john"
}

Request Parameters

ParameterTypeRequiredDefaultDescription
rolestringYes-User role to filter by (e.g., "moderator", "admin")
pagenumberNo1Page number for pagination (starts from 1)
limitnumberNo25Number of users per page (10, 25, 50, 100)
sortBystringNo"name"Field to sort by ("name" or "createdAt")
sortOrderstringNo"ASC"Sort order ("ASC" or "DESC")
searchstringNo""Search term to filter users by name, email, or username

Example Requests

JavaScript (fetch)

const res = await fetch('https://api.samvyo.com/api/user/fetchDeletedOrgUsers', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${authToken}`
  },
  body: JSON.stringify({
    role: 'moderator',
    page: 1,
    limit: 25,
    sortBy: 'name',
    sortOrder: 'ASC',
    search: 'john'
  })
});
const data = await res.json();

cURL

curl -X POST \
  'https://api.samvyo.com/api/user/fetchDeletedOrgUsers' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <YOUR_AUTH_TOKEN>' \
  -d '{
    "role": "moderator",
    "page": 1,
    "limit": 25,
    "sortBy": "name",
    "sortOrder": "ASC",
    "search": "john"
  }'

Success Response

{
  "success": true,
  "users": [
    {
      "id": "<USER_ID_1>",
      "email": "john.doe@example.com",
      "name": "John Doe",
      "createdAt": "2025-08-06T02:16:24.398Z",
      "location": "New York",
      "username": "john_doe_123",
      "role": "moderator",
      "accountSuspended": false,
      "accountDeleted": true,
      "profileId": "1234567890",
      "meetNowEnabled": true,
      "displayRating": false,
      "tags": ["sales"],
      "admin": true,
      "rooms": ["Sales Team", "General"],
      "roomIds": ["room_123", "room_456"]
    },
    {
      "id": "<USER_ID_2>",
      "email": "jane.smith@example.com",
      "name": "Jane Smith",
      "createdAt": "2025-08-07T02:12:39.474Z",
      "location": "San Francisco",
      "username": "jane_smith_456",
      "role": "moderator",
      "accountSuspended": false,
      "accountDeleted": true,
      "profileId": "0987654321",
      "meetNowEnabled": true,
      "displayRating": true,
      "tags": ["customer success"],
      "admin": false,
      "rooms": ["Support Team"],
      "roomIds": ["room_789"]
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 25,
    "total": 45,
    "totalPages": 2
  }
}

Response Fields

Users Array

Each revoked user object contains the same fields as active users, plus:

  • accountDeleted: Boolean indicating the user has been revoked (always true for this endpoint)
  • rooms: Array of room names the user owned (for audit purposes)
  • roomIds: Array of room IDs the user owned (for audit purposes)

Pagination Object

FieldTypeDescription
pagenumberCurrent page number
limitnumberNumber of users per page
totalnumberTotal number of revoked users matching the criteria
totalPagesnumberTotal number of pages available

Error Responses

Invalid Sort Field

{
  "success": false,
  "message": "Invalid sort field. Allowed fields: name, createdAt"
}

Invalid Sort Order

{
  "success": false,
  "message": "Invalid sort order. Must be ASC or DESC"
}

Database Error

{
  "success": false,
  "message": "Database error occurred",
  "error": "column a.invalidfield does not exist"
}

Use Cases

Basic Pagination for Revoked Users

{
  "role": "moderator",
  "page": 1,
  "limit": 25
}

Search Revoked Users

{
  "role": "moderator",
  "page": 1,
  "limit": 25,
  "search": "john"
}

Sort Revoked Users by Creation Date

{
  "role": "moderator",
  "page": 1,
  "limit": 25,
  "sortBy": "createdAt",
  "sortOrder": "DESC"
}

Audit Trail - Recent Revocations

{
  "role": "moderator",
  "page": 1,
  "limit": 50,
  "sortBy": "createdAt",
  "sortOrder": "DESC"
}

Business Logic

Revoked User Status

  • Users returned by this endpoint have accountDeleted: true
  • These users cannot log into the system
  • Their data is retained for audit purposes
  • Room ownership information is preserved for historical reference

Reactivation Process

  • Revoked users can be reactivated using the Reactivate User endpoint
  • Reactivation restores full access to the system
  • User credentials may need to be reset after reactivation

Data Retention

  • Revoked user data is retained indefinitely unless permanently deleted
  • Room associations are preserved for audit trails
  • Historical activity data remains accessible

Performance Notes

  • Search is case-insensitive and matches against name, email, and username
  • Sorting is optimized for the allowed fields (name, createdAt)
  • Pagination limits help manage large datasets efficiently
  • Room information is included for audit purposes
  • Query performance is optimized for the accountDeleted: true filter