PERS SDK - v2.3.26 / Exports / UserApi
Platform-Agnostic User API Client
Handles user operations using the PERS backend RESTful API. Updated to use new /users endpoints with enhanced security and consistency. Maintains framework UserApiService method compatibility.
- getAllUsersPublicProfiles
- getPublicProfileById
- getRemoteUser
- updateRemoteUser
- createOrUpdateUser
- createOrUpdateUsers
- getAllRemoteUsers
- updateUserAsAdmin
- setUserActiveStatus
- getUserByUniqueIdentifier
- deleteUser
- restoreUser
- exportCSV
• new UserApi(apiClient): UserApi
| Name | Type |
|---|---|
apiClient | PersApiClient |
▸ getAllUsersPublicProfiles(filter?, options?): Promise<PaginatedResponseDTO<UserPublicProfileDTO>>
PUBLIC: Get all users public profiles with optional filtering Uses new RESTful /users/public endpoint
| Name | Type | Default value |
|---|---|---|
filter | null | { key: string ; value: string } | null |
options? | PaginationOptions | undefined |
Promise<PaginatedResponseDTO<UserPublicProfileDTO>>
▸ getPublicProfileById(id): Promise<UserPublicProfileDTO>
PUBLIC: Get a single user's public profile by ID Uses RESTful /users/public/:id endpoint
| Name | Type |
|---|---|
id | string |
Promise<UserPublicProfileDTO>
▸ getRemoteUser(options?): Promise<UserDTO>
AUTH: Get current authenticated user Uses new RESTful /users/me endpoint
| Name | Type | Description |
|---|---|---|
options? | UserQueryParams | Query options. Use include to specify relations: 'status' (user status types), 'balances' (token balances) |
Promise<UserDTO>
▸ updateRemoteUser(updateRequest): Promise<UserDTO>
AUTH: Update current authenticated user Uses new RESTful /users/me endpoint
| Name | Type |
|---|---|
updateRequest | UserCreateRequestDTO |
Promise<UserDTO>
▸ createOrUpdateUser(userData): Promise<UserDTO>
BUSINESS/ADMIN: Create or update user account
Creates a new user or updates an existing one.
- Business auth: Can create/update single users (requires canManageUsers permission)
- Admin auth: Can create/update single users or bulk operations
| Name | Type | Description |
|---|---|---|
userData | UserCreateRequestDTO | User data for creation/update |
Promise<UserDTO>
Created or updated user
▸ createOrUpdateUsers(users): Promise<UserDTO[]>
ADMIN: Bulk create or update users
Creates or updates multiple users in a single operation. Requires admin authentication - business auth cannot perform bulk operations.
| Name | Type | Description |
|---|---|---|
users | UserCreateRequestDTO[] | Array of user data for creation/update |
Promise<UserDTO[]>
Array of created/updated users
▸ getAllRemoteUsers(options?, search?): Promise<PaginatedResponseDTO<UserDTO>>
ADMIN: Get all remote users with query parameters Uses new RESTful /users endpoint with role-based access Note: Admin users get full data, non-admin users get public profiles only
| Name | Type | Description |
|---|---|---|
options? | PaginationOptions | Pagination options (page, limit, sortBy, sortOrder) |
search? | string | Optional search query to filter users |
Promise<PaginatedResponseDTO<UserDTO>>
Example
// Get users sorted by email
const users = await sdk.users.getAllUsers({
page: 1,
limit: 10,
sortBy: 'email',
sortOrder: SortOrder.ASC
});
// Search for users
const searchResults = await sdk.users.getAllUsers({ page: 1, limit: 10 }, 'john');▸ updateUserAsAdmin(id, userData): Promise<UserDTO>
ADMIN: Update user as admin Uses new RESTful /users/{id} endpoint
| Name | Type |
|---|---|
id | string |
userData | UserCreateRequestDTO |
Promise<UserDTO>
▸ setUserActiveStatus(userId, isActive?): Promise<UserDTO>
ADMIN: Set or toggle user active status Uses new consistent /users/{id}/status endpoint Enhanced: Follows RESTful status management pattern across all domains
| Name | Type | Description |
|---|---|---|
userId | string | User ID |
isActive? | boolean | Optional explicit status. If provided, sets to this value. If omitted, toggles current status. |
Promise<UserDTO>
Example
// Explicit set
await sdk.users.setUserActiveStatus('user-123', true); // Activate
await sdk.users.setUserActiveStatus('user-123', false); // Deactivate
// Toggle (current behavior)
await sdk.users.setUserActiveStatus('user-123'); // Flips current status▸ getUserByUniqueIdentifier(id, options?): Promise<UserDTO>
ADMIN: Get user by unique identifier Uses new RESTful /users/{id} endpoint
| Name | Type | Description |
|---|---|---|
id | string | User unique identifier (id, email, externalId, accountAddress, etc.) |
options? | UserQueryParams | Query options. Use include to specify relations: 'status' (user status types), 'balances' (token balances) |
Promise<UserDTO>
▸ deleteUser(identifier): Promise<{ success: boolean ; message: string }>
ADMIN: Delete user by identifier (soft delete) Uses RESTful /users/{identifier} DELETE endpoint
Soft deletes a user. The user data is retained for 30 days before GDPR anonymization. Use restoreUser() to restore within the grace period.
| Name | Type | Description |
|---|---|---|
identifier | string | User unique identifier (id, email, externalId, accountAddress, etc.) |
Promise<{ success: boolean ; message: string }>
Promise resolving to success status and message
▸ restoreUser(identifier): Promise<UserDTO>
ADMIN: Restore deleted user by identifier Uses RESTful /users/{identifier}/restore POST endpoint
Restores a soft-deleted user within the 30-day grace period. After GDPR anonymization (30 days), restoration is not possible.
| Name | Type | Description |
|---|---|---|
identifier | string | User unique identifier (id, email, externalId, accountAddress, etc.) |
Promise<UserDTO>
Promise resolving to restored user data
▸ exportCSV(options?): Promise<Blob>
ADMIN: Export users to CSV
Returns a CSV file with user data for the tenant. Supports date range filtering.
| Name | Type | Description |
|---|---|---|
options? | Object | Export options (dateFrom, dateTo in ISO format) |
options.dateFrom? | string | - |
options.dateTo? | string | - |
Promise<Blob>
CSV blob
Example
// Export all users
const blob = await sdk.users.exportCSV();
// Export users created in date range
const blob = await sdk.users.exportCSV({
dateFrom: '2026-01-01',
dateTo: '2026-05-31'
});